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

Layer Switcher Control with Draw Plugin #86

Open
Martenz opened this issue Jul 4, 2024 · 1 comment
Open

Layer Switcher Control with Draw Plugin #86

Martenz opened this issue Jul 4, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Martenz
Copy link

Martenz commented Jul 4, 2024

When using the Draw plugin in combination with the Layer Switch control it would be handy to have the possibility to add the layer of drawn features as a layer or separated layers (one for each element? maybe too much).
In this way it would be possible to hide or show the feature, for instance when interacting with objects on the map eg:

  • need to perform a click for a popup on a layer below a drawn feature
@crazycapivara crazycapivara self-assigned this Jul 5, 2024
@crazycapivara crazycapivara added the enhancement New feature or request label Jul 5, 2024
@crazycapivara
Copy link
Contributor

crazycapivara commented Jul 5, 2024

The draw-plugin creates a lot of layers which we need to toggle.

It creates layers for every geometry type, active or inactive, ...

In the developer tools we can check it like this:

// Get all draw layers
_maplibreWidget._map.getLayersOrder().filter(l => l.startsWith("gl-draw"))

// Get all draw polygon layers
_maplibreWidget._map.getLayersOrder().filter(l => l.startsWith("gl-draw-polygon"))

_maplibreWidget._map.setLayoutProperty("gl-draw-polygon-fill-inactive.hot", "visibility", "none")
_maplibreWidget._map.setLayoutProperty("gl-draw-polygon-stroke-inactive.hot", "visibility", "none")

Therefore, I need to add layer groups that can be toggled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants