Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DragPan stops working after clicking the same feature twice without moving the mouse #1328

Open
fede-qubika opened this issue Dec 18, 2024 · 0 comments

Comments

@fede-qubika
Copy link

mapbox-gl-js version: 3.8.0
mapbox-gl-draw version: 1.5.0

Steps to Trigger Behavior

  1. Select a feature (not a Point)
  2. Click on the feature again.
  3. Click on the same feature once more without moving the mouse

Expected Behavior

If the dragPan option (map.dragPan) was enabled before interacting with the feature (map.dragPan.isEnabled() is true), it should remain enabled after the interaction.

Actual Behavior

dragPan is disabled

Context

It seems the issue was introduced in this PR: #1216

Clicking a feature at least twice without moving the mouse triggers DirectSelect.startDragging twice in a row, without ever calling DirectSelect.stopDragging in between. As a result, dragPan is disabled, and the initialDragPanState property in the state is set to false, making it unable to return to true in subsequent stopDragging calls.

I think one potential solution would involve removing the premature returns from DirectSelect.onClick to ensure that stopDragging is always invoked between consecutive clicks. (Note that in the mentioned case, DirectSelect.onMouseUp is not called, only DirectSelect.onClick.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant