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

add keyboard.disableRotation and tests #10072

Merged
merged 2 commits into from
Nov 9, 2020

Conversation

jmbott
Copy link
Contributor

@jmbott jmbott commented Nov 3, 2020

fix #3768

adds the option to disable and enable map rotation from the keyboard,

// disable
map.keyboard.disableRotation();
// enable
map.keyboard.enableRotation();

similar to,

// disable
map.touchZoomRotate.disableRotation();
// enable
map.touchZoomRotate.enableRotation();

so you do not have to disable all zooming and panning options the keyboard can provide with map.keyboard.disable().

adds unit tests to support,

  • map still pans when rotation disabled
  • map does not rotate when rotation is disabled
  • map does not tilt when rotation is disabled
  • map still zooms when rotation is disabled

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • document any changes to public APIs
  • post benchmark scores
  • manually test the debug page
  • tagged @mapbox/map-design-team @mapbox/static-apis if this PR includes style spec API or visual changes
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>adds disableRotation() and enableRotation() to KeyboardHandler</changelog>

@mapbox/map-design-team @mapbox/static-apis adds to KeyboardHandler instance members

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

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

Thanks so much for the PR and extensive tests! Would you mind also adding JSDoc comments for the methods like in touch_zoom_rotate.js for completeness while we're at it? Should be mostly copy-paste.

@jmbott
Copy link
Contributor Author

jmbott commented Nov 9, 2020

@mourner Thank you for the review! Added JSDoc comments for keyboard.js. Let me know if anything else is required.

@mourner mourner merged commit 94e4714 into mapbox:main Nov 9, 2020
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.

Disable rotation in the keyboard handler
2 participants