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

Added more customization to cursor/keyboard rotation #1642

Merged
merged 4 commits into from
Oct 2, 2023

Conversation

JaffaKetchup
Copy link
Member

@JaffaKetchup JaffaKetchup commented Sep 6, 2023

The implementation of cursor/keyboard rotation in #1592 set the North of the map to the angle of the cursor. This is now named setNorth in CursorRotationBehaviour.
However, at the time I noted that an alternative might be possible, and this was requested by @androidseb (in #1592 (comment)): offsetting the current rotation based on the difference between the cursor's start and end angle, instead of just setting it. This has been named offset.

Optionally (on by default), it is now possible to set the map's rotation to the clicked angle (when triggered as normal), instead of needing a drag.

These options are now encapsulated in a dedicated object CursorKeyboardRotationOptions, set from InteractionOptions (which has also been refactored into its own separate file to reduce the scope of 'options.dart'). Options have also been renamed to be shorter, and improve clarity within documentation.

Additionally:

  • Fixed a bug where flinging during cursor/keyboard rotation would start pan fling animation and exit rotation
  • Fixed (some?) bugs with incorrect gesture event emission when cursor/keyboard rotating
  • Removed seemingly? unnecessary variables from the cursor/keyboard rotation code
  • Improved performance by not setting variables on every build unnecessarily

Note: there are many issues with the current gesture handling system, mostly inconsistent event emission, which seems to have been somewhat complicated by a different PR which added more ways to emit events: there now appears to be 3 or 4. This PR has not fixed that, and has indeed made it more inconsistent. A larger rewrite is required to fix this.

…tive to '`setNorth`'

Fixed bug where flinging during cursor/keyboard rotation would start pan fling animation and exit rotation
Refactored `InteractionOptions` into seperate source file
…otationOptions` object

Added customization to whether to set North on click with cursor/keyboard rotation
Removed seemingly unncessary variables
Attempted to improve consistency of emitted gesture events
Improved documentation
@JaffaKetchup
Copy link
Member Author

With @androidseb's suggestions in mind, I've changed the way cursor/keyboard rotation is configured considerably. Check this PR's updated description.

(Keep in mind that none of these changes are technically breaking, as development/preview versions are assumed to be unstable.)

@JaffaKetchup JaffaKetchup changed the title Added 'offset' capability to cursor/keyboard rotation Added more customization cursor/keyboard rotation Sep 7, 2023
@JaffaKetchup
Copy link
Member Author

I'm going to break standard procedures here and merge my own PR without a second maintainer's approval. This PR only affects what was already added in a prerelease version, and we need to get v6 on the move at some point!

Happy to make changes if required by another maintainer.

@JaffaKetchup JaffaKetchup changed the title Added more customization cursor/keyboard rotation Added more customization to cursor/keyboard rotation Oct 2, 2023
@JaffaKetchup JaffaKetchup merged commit b75166a into master Oct 2, 2023
7 checks passed
@JaffaKetchup JaffaKetchup deleted the improve-cursorkeyboard-rotation branch October 2, 2023 20:56
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.

[FEATURE] Implement rotation functionality on mouse/cursor based platforms
2 participants