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 geographical and screen coordinates to map interaction callbacks #473

Merged
merged 5 commits into from
Apr 11, 2024

Conversation

evil159
Copy link
Contributor

@evil159 evil159 commented Apr 4, 2024

What does this pull request do?

Introduces MapContentGestureContext carrying touch point and projected map coordinate under the touch point of a gesture.

Changes tap, long tap and move gesture callbacks to use MapContentGestureContext instead of ScreenCoordinate.

What is the motivation and context behind this change?

ScreenCoordinate is not a correct type to represent geographical position. This is also a matter of ergonomics of providing both touch and geographical positions of a gesture.

Addresses: https://mapbox.atlassian.net/browse/MAPSFLT-111, #81 and #190.

Pull request checklist:

  • Add a changelog entry.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add documentation comments for any added or updated public APIs.

static MapContentGestureContext decode(Object result) {
result as List<Object?>;
return MapContentGestureContext(
touchPosition: ScreenCoordinate.decode(result[0]! as List<Object?>),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way we can avoid the forced !?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code is Pigeon-generated, it seems that the assumptions here, since the decoding and encoding is both done by Pigeon, they deem to be acceptable to force unwrap it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems fair 👍

Copy link
Contributor

@pjleonard37 pjleonard37 left a comment

Choose a reason for hiding this comment

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

Looks really nice 😎

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
evil159 and others added 2 commits April 11, 2024 09:26
Co-authored-by: Patrick Leonard <pjleonard37@users.noreply.github.com>
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.

None yet

2 participants