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

Function for custom styling of drawn polygons #1109

Open
SnailBones opened this issue May 19, 2022 · 0 comments
Open

Function for custom styling of drawn polygons #1109

SnailBones opened this issue May 19, 2022 · 0 comments
Labels
feature rendering Rendering issues and errors

Comments

@SnailBones
Copy link

SnailBones commented May 19, 2022

From #833 (comment)

If this is something more people want, I could see a "styleFeature" function being added to Draw that would allow a user to set a features style. Internally this would add a style layer to the mapbox-gl-js that references that id of the feature.

draw.styleFeature('id', { style json })

The style json would be a paired down version of what is in the default styles, noting that filter, id and source would all need to be left off so that Draw could set them.

draw.styleFeature('id', null)

Would remove the style from the map as would draw.deleteFeature('id').

This issue is for discussing adding a new styleFeature() funciton to future versions of the library. For workarounds in the current version, see #833 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature rendering Rendering issues and errors
Projects
None yet
Development

No branches or pull requests

1 participant