mapbox / mapbox-gl-draw

Draw tools for mapbox-gl-js
https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
ISC License
955 stars 593 forks source link

Feature request: leave draw tool active after object is placed #709

Open IAfanasov opened 7 years ago

IAfanasov commented 7 years ago

mapbox-gl-js version: v0.39.1 mapbox-gl-draw version:v1.0.2

Steps to Trigger Behavior

place object (for example point)

Expected Behavior

can place one more object right away

Actual Behavior

need to select draw tool before placing one more object

Need this option to reduces user's click count. In my scenario users are making lots of dots and it's really unproductive to select point tool after placing each point. Some approach to activate draw tool will work as well.

mcwhittemore commented 7 years ago

I think Mapbox GL Draw Static Mode should do this for you.

IAfanasov commented 7 years ago

@mcwhittemore thanks for such an quick answer! will check it tomorrow

IAfanasov commented 7 years ago

@mcwhittemore based on description of static mode on page https://github.com/mapbox/mapbox-gl-draw-static-mode it's only displays data. In my scenario user should be able to place points and change positions of existing points. Looks like dbclick or contextmenu event works better for me

mcwhittemore commented 7 years ago

Oh! Wow. Sorry. To do this, you should listen for the draw.modechange event change the mode back to the draw mode that is being left. There is also probably a way to do this by changing the default modes offered by Draw a bit as well.

That said, Draw isn't currently accepting changes to how its modes function past bug fixes. We're more than happy to promote custom modes though.