Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] Add ruler customization options #38

Merged
merged 4 commits into from
Sep 24, 2024

Conversation

xalvaine
Copy link
Contributor

Добавил возможность кастомить:

  • линию
  • точки (писать вместо них кастомные маркеры)
  • превью линии
  • превью точки
  • заливку полигона

Также добавил возможность не показывать последнюю линию в режиме рисования, но хз, насколько это универсальная фича или как её таковой сделать

Как это может выглядеть:
Screenshot 2024-09-12 at 19 14 36

@xalvaine
Copy link
Contributor Author

Код превью (редачил в demo/index.ts)

window.control = new RulerControl(map, {
    position: 'centerRight',
    mode: 'polygon',
    polygonOptions: {
        color: '#028EFF1A',
    },
    polylineOptions: {
        lineColor: '#0099FF',
        lineWidth: 2,
        lineBorderColor: '#FFFFFF',
        lineBorderWidth: 2,
        lineBorder2Width: 0,
        autoClosePolygon: false,
        previewLineColor: '#0099FF',
    },
    renderCustomJointHtmlMarker: (map, coordinates) => {
        return new mapgl.HtmlMarker(map, {
            coordinates,
            html: `<div style="width: 10px;height: 10px; background: red;transform: translate(-50%,-50%)"></div>`,
        });
    },
    renderCustomSnapPointHtmlMarker: (map, coordinates) => {
        return new mapgl.HtmlMarker(map, {
            coordinates,
            html: `<div style="width: 10px;height: 10px; background: red;transform: translate(-50%,-50%)"></div>`,
            interactive: false,
        });
    },
});

@xalvaine xalvaine force-pushed the add-ruler-ui-customization-options branch from 13dcee5 to 21c1895 Compare September 12, 2024 16:26
@xalvaine xalvaine force-pushed the add-ruler-ui-customization-options branch from 21c1895 to ca46238 Compare September 12, 2024 16:28
@itanka9 itanka9 self-requested a review September 13, 2024 09:26
@Kuznecoff Kuznecoff self-requested a review September 18, 2024 08:58
@xalvaine xalvaine force-pushed the add-ruler-ui-customization-options branch from 534b0d5 to 1d39649 Compare September 19, 2024 07:59
@xalvaine xalvaine requested a review from Kuznecoff September 23, 2024 00:07
@itanka9 itanka9 merged commit 8613a01 into 2gis:master Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants