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

Clicking a feature 4 or more times quickly it makes it so you cannot move the map

Open kthyer opened this issue 10 months ago • 8 comments

I ran into a bug that occurs on v1.5.0 but not on v1.4.3

When I draw a polygon and click it 4 or more times in quickly I can no longer move the map.

I can still zoom, pan, tilt but click and drag will not move the map.

I was able to reproduce on both the mapbox and maplibre docs which are hosting the latest 1.5.0 version

https://docs.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/ https://maplibre.org/maplibre-gl-js/docs/examples/mapbox-gl-draw/

Reproduction Steps

  • Draw a polygon
  • Click it 4 times quickly
  • Try to move the map

kthyer avatar Feb 26 '25 21:02 kthyer

We're experiencing the same issue. For us, it happens when drawing a line, selecting its endpoint, and moving it around. If the cursor moves outside the viewport, it gets stuck. Zooming, panning, and tilting still work, but moving the map does not.

LukasGrubis avatar Feb 27 '25 06:02 LukasGrubis

Any update regarding this issue?

LukasGrubis avatar Mar 10 '25 06:03 LukasGrubis

I can confirm I'm seeing the same issue

NicHaley avatar Apr 27 '25 17:04 NicHaley

Just wanted to check if anyone has started looking into this issue, or if it might still be unaddressed? We’re still encountering it and would really appreciate any updates or suggestions. Thanks in advance!

LukasGrubis avatar May 14 '25 05:05 LukasGrubis

We are having the same issue. Have you found any workarounds?

olofholmlund avatar May 21 '25 11:05 olofholmlund

Has anyone figured out how to resolve this issue or at least has any idea what might be causing it? Could it be related to the library itself, or is it a core Mapbox GL issue (perhaps something with native events)?

This issue is quite important — it doesn't just freeze the map when clicking a feature multiple times, but also during drawing if the user's cursor leaves the map and interacts with something else. That action freezes the map as well.

LukasGrubis avatar Jun 27 '25 04:06 LukasGrubis

Has anyone figured out how to resolve this issue or at least has any idea what might be causing it? Could it be related to the library itself, or is it a core Mapbox GL issue (perhaps something with native events)?

This issue is quite important — it doesn't just freeze the map when clicking a feature multiple times, but also during drawing if the user's cursor leaves the map and interacts with something else. That action freezes the map as well.

We found a workaround to this by manually enabling dragPan on the map object whenever the draw selection changes. Some pseudocode:

map.on("draw.selectionchange", () => {
 map.dragPan.enable();
}); 

I have not looked into as to why it happens, but dragPan seems to become disabled whenever a feature is clicked too many times. This code make sure dragPan is always enabled whenever the user clicks something. Hope this helps.

olofholmlund avatar Jun 27 '25 09:06 olofholmlund

@olofholmlund 's workaround fixed a likely similar problem when extending a LineString on iPhone and drag somehow gets disabled. Thanks!

jaybo avatar Aug 13 '25 17:08 jaybo