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

Letting go of ctrl while holding the left click doesnt disable pitch and bearing. #4187

Closed
rgtaylor1989 opened this issue Feb 2, 2017 · 4 comments

Comments

@rgtaylor1989
Copy link

mapbox-gl-js version: v0.32.1

Link: https://www.mapbox.com/mapbox-gl-js/examples/

Steps to Trigger Behavior

  1. Ctrl+Left Click on the map to start changing the bearing and pitch.
  2. While holding the Left Click, release the Ctrl key.
  3. Release the Left Click
  4. The map will continue to fire the function to change the map bearing and pitch even when you left click. The only way to stop the function is to right click or Ctrl+Left Click

Expected Behavior

When Ctrl is released, the map changes state from changing the bearing and pitch to moving the map.

Actual Behavior

The map keeps changing the bearing and pitch.

Notes

I dont know if this would constitute as a bug ... however the feel / design of this function is kind of strange. I am working on a project that will use the right click as a context menu instead of changing the map's pitch and bearing. The Ctrl+Left click will be the way to change the pitch and bearing. While testing, I find myself letting go of Ctrl 1st before releasing left click which keeps the map state for changing the map's bearing and pitch. I feel like when I release Ctrl, the pitch and bearing should stop changing ... similar to the way google maps handles changing the pitch and bearing.

Ex: https://www.google.com/maps/@39.0163933,-81.2153151,2182415a,20y,6.56h/data=!3m1!1e3

@andrewharvey
Copy link
Collaborator

Looks like a duplicate of #1888 #3389

@jfirebaugh
Copy link
Contributor

Agreed, closing as duplicate.

@rgtaylor1989
Copy link
Author

I did some digging into the code

Mapbox GL Code

The issue is when the user lets go of ctrl and then lets go of the left mouse click, this._ignoreEvent(e) on line 128 returns "true" (https://github.com/mapbox/mapbox-gl-js/blob/master/js/ui/handler/drag_rotate.js#L128). This causes the rest of the _onUp(e) function not to run ... which causes the drag_rotate handler to be stuck on _onMove(e).

The problem is with _ignoreEvent(e) it seems? (https://github.com/mapbox/mapbox-gl-js/blob/master/js/ui/handler/drag_rotate.js#L193).

@rgtaylor1989
Copy link
Author

Is there any reason to have line 128? If removed it fixes this problem. I dont know if it will break anything else though by removing this line.

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

3 participants