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

Ensure DragRotate stops after releasing mouse button when Ctrl is already released. Fixes #1888 #4389

Merged
merged 1 commit into from
Mar 10, 2017

Conversation

andrewharvey
Copy link
Collaborator

Launch Checklist

  • briefly describe the changes in this PR

Fixes #1888. I've tried my best to test this doesn't have any other unintended consequences but it would be great if others can test it too.

In my view this is fairly high priority to fix as it creates a poor user experience and seems to affect quite a number of people.

  • write tests for all new functionality

I couldn't find any interaction unit tests for the DragRotateHandler, so I didn't add a test case.

  • document any changes to public APIs
    N/A

  • post benchmark scores

  • manually test the debug page

I've only tested in on my Linux machine under Chrome and Firefox, specifically I can confirm that these all work:

  • Pan (left mouse)
  • Rotate (right mouse)
  • Rotate (drag left mouse on the reset north button)
  • Shift Zoom
  • Rotate (left mouse + Ctrl, letting go of left mouse first)
  • Rotate (left mouse + Ctrl, letting go of Ctrl first)

Further details on my reasoning and approach:

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 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.
Copy link
Contributor

@lucaswoj lucaswoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can verify that this fixes the bug and as best I can tell does not introduce any ill-effects. Thank you for shipping this high pri fix! 👍

@lucaswoj lucaswoj merged commit 6af8b6f into mapbox:master Mar 10, 2017
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

Successfully merging this pull request may close these issues.

Fix behavior in which releasing the CTRL-key before mouse button causes map to continue rotating
2 participants