mapbox / mapbox/mapbox-gl-draw
Overwriting button click to draw a different object
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 5
Description
Hi, so on my current setup I am using [react-mapbox-gl ](https://github.com/alex3165/react-mapbox-gl/blob/master/docs/API.md)with mapbox-gl-draw and [mapbox-gl-draw-circle](https://github.com/iamanvesh/mapbox-gl-draw-circle).
I am able to reroute the `draw_marker` or `draw_line_string` modes to draw circles when they are clicked, but the `draw_polygon` button remains routed to `draw_circle`, no matter where I try to overwrite it. I believe this is due to `draw_circle` using `draw_polygon` to draw the circle on the map.
For example, when I click the marker button, I made it draw a circle on the map. However, when I click the polygon button, it still draws a circle on the map instead of a regular polygon.
**So, here's my question:** Is it possible to overwrite a buttons for different drawing functionality? (EX: The marker button draws a circle and the polygon button draws a polygon, or the polygon button draws a circle and the line button draws a polygon, etc...)
Thanks!
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 with the react-mapbox-gl API documentation and the mapbox-gl-draw-circle integration described in the issue. Reproduce the button routing and inspect how the circle mode relies on polygon drawing; done should allow the selected controls to invoke distinct drawing behaviors without one mode unexpectedly replacing another.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100