mapbox / mapbox/mapbox-gl-draw
Function for custom styling of drawn polygons
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
From https://github.com/mapbox/mapbox-gl-draw/issues/833#issuecomment-438673488
> 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 https://github.com/mapbox/mapbox-gl-draw/issues/833#issuecomment-437002873.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing issue 833 and the linked comments, including the documented workaround. Determine how a proposed styleFeature() API would add and remove per-feature style layers while leaving Draw-controlled fields unset. Done would mean an agreed API and implementation scope, including behavior for null styles and deleted features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100