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

Map.isMoving() incorrectly returns true inside mouseup event handler #9647

Closed
DannyDelott opened this issue May 1, 2020 · 2 comments
Closed

Comments

@DannyDelott
Copy link
Contributor

mapbox-gl-js version:
1.10.0

browser:
Chrome Version 81.0.4044.129 (Official Build) (64-bit)

It looks like there was a possible regression introduced in mapbox-gl@1.10.0 that affects the result of map.isMoving() inside the mouseup event handler.

Steps to Trigger Behavior

  1. Add a layer to the map, then set a mouseup event handler on it.
  2. Click on one of the layer's feature and call map.isMoving() in the handler.

Link to Demonstration

🐞mapbox-gl@1.10.0 - https://codesandbox.io/s/magical-leavitt-6zhso
mapbox-gl@1.9.1 - https://codesandbox.io/s/lucid-hawking-ruywl

Expected Behavior

Clicking on Maine should output map.isMoving() === false, ie:

map.on('mouseup', statesLayerId, () => {
  map.isMoving() // false
}

Actual Behavior

Clicking on Maine outputs map.isMoving() === true

@arindam1993
Copy link
Contributor

Thanks for the solid bug report @DannyDelott !

@ansis would you know whats causing this?

@karimnaaji karimnaaji added this to the 0.10.1 milestone May 5, 2020
@karimnaaji
Copy link
Contributor

@ansis is this related to #9365 (comment)?

ansis added a commit that referenced this issue May 12, 2020
Previously isMoving() would return true if any interaction handler was
active. Handlers are sometimes active even if they haven't changed the
map yet. This resulted in the isMoving() returning true when the map
hasn't moved.

This makes isMoving aligned with movestart/move/moveend events.

Since move events may be fired after several mouse events have been
batched, the camera changes a mouseevent will *later* cause won't be
reflected in isMoving() when that mouseevent is fired.
karimnaaji pushed a commit that referenced this issue May 14, 2020
* map.isMoving() match move events fix #9647

Previously isMoving() would return true if any interaction handler was
active. Handlers are sometimes active even if they haven't changed the
map yet. This resulted in the isMoving() returning true when the map
hasn't moved.

This makes isMoving aligned with movestart/move/moveend events.

Since move events may be fired after several mouse events have been
batched, the camera changes a mouseevent will *later* cause won't be
reflected in isMoving() when that mouseevent is fired.

* lint

* fix test
karimnaaji pushed a commit that referenced this issue May 14, 2020
* map.isMoving() match move events fix #9647

Previously isMoving() would return true if any interaction handler was
active. Handlers are sometimes active even if they haven't changed the
map yet. This resulted in the isMoving() returning true when the map
hasn't moved.

This makes isMoving aligned with movestart/move/moveend events.

Since move events may be fired after several mouse events have been
batched, the camera changes a mouseevent will *later* cause won't be
reflected in isMoving() when that mouseevent is fired.

* lint

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

No branches or pull requests

4 participants