mapbox-gl-draw icon indicating copy to clipboard operation
mapbox-gl-draw copied to clipboard

Overwriting button click to draw a different object

Open ev0065 opened this issue 6 years ago • 2 comments

Hi, so on my current setup I am using react-mapbox-gl with mapbox-gl-draw and 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!

ev0065 avatar Jul 22 '19 17:07 ev0065

It sounds like you're trying to hijack an existing button in order to toggle a custom mode. Can you use a new/custom button instead of reusing an existing one?

kkaefer avatar Jan 09 '20 10:01 kkaefer

hello ev, please can you tell me how can I reroute a button to circle mode

Aliber009 avatar Apr 07 '21 08:04 Aliber009