mapbox / mapbox-gl-draw

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

Draw mode is not transitioning to simple_select on draw.create event #793

Open rmsmq opened 6 years ago

rmsmq commented 6 years ago

mapbox-gl-js version: 0.45.0 mapbox-gl-draw version: 1.0.9

Steps to Trigger Behavior

Use plunker below; https://plnkr.co/x3R0TtHsNGzxPxAOL7HH

  1. After map and draw tools load, draw a point
  2. The draw.create event fires and console.logs the feature, and the current mode.
  3. Try to set the mode to draw_point to continue drawing points (does not work)

Expected Behavior

Based on the documentation - https://github.com/mapbox/mapbox-gl-draw/blob/master/docs/API.md#modes

Expect the Draw.mode to transition to simple_select and that you can change the mode back to draw_point to continue drawing points.

Actual Behavior

The mode is still in draw_point and you can not draw another point.

mcwhittemore commented 6 years ago

@rmsmq - Thanks for submitted this bug report. The draw.create doesn't mark the end of the mode and it looks like you found a bug where draw_point fails to clean up its state if you move from draw_point to draw_point. Figuring out how to fix this is going to take some time so if you can use the draw.modechange event rather than the draw.create event you should be fine.