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

Popup cannot open at draw.create #779

Open hyperknot opened 6 years ago

hyperknot commented 6 years ago

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

Steps to Trigger Behavior

  1. Listen for draw.create
  2. Create a popup inside it

Expected Behavior

Popup should open

Actual Behavior

Popup does not open.

Example Click somewhere on the map, try with setTimeout uncommented. https://codesandbox.io/s/6y4x0oxw9k

Is is possible that this is a duplicate of an issue from 2016? https://github.com/mapbox/mapbox-gl-draw/issues/495

What is the right solution here? Using setTimeout is such a hack and I cannot be sure that it'll work for everyone. Still, with setTimeout it can be made to work.

mcwhittemore commented 6 years ago

Yea, per #495, Draw and Popup have a conflict caused by how Popup uses mouse events to close the popup. These events are controlled within gl-js and not in Draw (assuming I'm remembering things correctly).

v-raja commented 3 years ago

Is this still an issue? I played around with the example and the popup worked as expected (even with the timeout uncommented).

chriszrc commented 3 years ago

@vivkr this is still an issue, I had to use closeOnClick:false for popups I wanted to open after draw.create, since that way the map click that initiated the event doesn't then also immediately close it-