-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix behavior in which releasing the CTRL-key before mouse button causes map to continue rotating #1888
Comments
Works fine for me on Chrome and Safari. @averas browser details? |
@planemad Are you on PC/Windows or PC/Linux? I realised this might be related to Mac/OSX touchpad behaviour where CTRL-touchpad click is the same as right click. Would be great if someone else with a Mac could confirm my finding. I see this behaviour in Chrome and Safari. In Firefox CTRL-click doesn't actually allow rotation as all. |
@averas i'm on OSX, using the touchpad |
Now that's really odd.. Anyone else on Mac (El Capitan) with touchpad? To add a little more detail:
At this point my map continues to rotate and the only way to get it to stop is do grab it again with CTRL-click as described above. Btw. @planemad is rotation working at all for you in Firefox? |
@averas yes, I'm having the issue on https://www.mapbox.com/mapbox-gl-js/examples/ and other examples. When tested on my own map this problem is not there. |
👍 Same for me! |
Thanks, that's good intel. My hunch would be that this is only triggered if the map is in an iframe. |
@jfirebaugh Good thinking. My maps that I initially discovered this behaviour on are not in iframes, however. |
Related to #3389? |
I did some digging into the code on this issue (moved from #4187 to an open bug for discussion) Mapbox GL CodeThe 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). 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. Different Approach (Maybe?!?!?!?!)Wouldnt it be better to have a function that can change between the Rotation_Pan and Pan seamlessly? See my logic below and an example code. I am certain the code will not work because I am not that familiar with Mapbox GL ... so perhaps someone who knows more could make it work (if it is even possible). Rotate Pan Handler Panmap
|
I have the same issue in Chrome and Firefox on MasOS. Both in the mapbox examples and in my own app (where the map control is not in an iframe) |
Yeah, please please fix this bugger. I drives me crazy. We have to release our app next month and I'm considering to disable this feature (with pain in my heart) because I'm sure our customers will be very unhappy due to this. |
We also have the same issue on Chrome/Firefox/Safari on Mac OS X El Capitan. Also reproducing the issue on a Windows10 WM. |
already released. Fixes mapbox#1888 The DragRotateHandler._keyUp method fires on a mouseup event so it can stop the rotation/active state when you release the mouse button. However this method also fires due to other interactions with the map such as DragPan. So the _ignoreEvent method determines if the event mouseup or other is to be ignored because it doesn't affect the DragRotateHandler. This commit ensures that when the mouseup event happens on the left mouse button without the Ctrl key pressed and DragRotate is still active that the event is not ignored so that DragRotate can be deactivated.
) already released. Fixes #1888 The DragRotateHandler._keyUp method fires on a mouseup event so it can stop the rotation/active state when you release the mouse button. However this method also fires due to other interactions with the map such as DragPan. So the _ignoreEvent method determines if the event mouseup or other is to be ignored because it doesn't affect the DragRotateHandler. This commit ensures that when the mouseup event happens on the left mouse button without the Ctrl key pressed and DragRotate is still active that the event is not ignored so that DragRotate can be deactivated.
If you rotate a map with the CTRL-key and let go of the CTRL-key before you release the left mouse button the map will keep rotating even after releasing the left mouse button. Clicking on the map will not stop the rotation. The only way to stop the rotation is "grabbing" the map again with the CTRL-key.
This behaviour is quite unintuitive.
The text was updated successfully, but these errors were encountered: