Skip to content

Annotation tap and long press events #977

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

Merged
merged 11 commits into from
Jun 27, 2025
Merged

Conversation

maios
Copy link
Contributor

@maios maios commented Jun 24, 2025

What does this pull request do?

This PR adds tapEvents and longPressEvents to Annotations API, allowing users to provide a callback to be invoked and an annotation is tapped or long pressed.
Both API will return a Cancelable token, which can be used to stop listening to interaction events.

With tapEvents, we are now aligning with platform implementation that use IME underlying, instead of using old API in iOS and observe interaction events via delegation, and since the tap interaction is now not propagated to the annotation below the topmost one, you will get exactly one callback when you tap on overlapping annotations as described in #791

What is the motivation and context behind this change?

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.

PRs must be submitted under the terms of our Contributor License Agreement CLA.

Sorry, something went wrong.

maios added 7 commits June 23, 2025 12:35
@maios maios marked this pull request as ready for review June 25, 2025 10:03
@maios maios requested a review from a team as a code owner June 25, 2025 10:03
@maios maios requested a review from pjleonard37 June 25, 2025 10:03
@maios maios changed the title Annotation tap event as cancelable Annotation tap and long press events Jun 25, 2025
@maios maios requested a review from evil159 June 25, 2025 14:37
@maios maios linked an issue Jun 25, 2025 that may be closed by this pull request
onAnnotationClick: (annotation) => circleAnnotation = annotation,
),
);
circleAnnotationManager?.tapEvents(onTap: (annotation) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can now remove the AnnotationClickListener class from this example (and the other examples). It would be good to do this so devs are not confused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

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.

Overall looks really good! A few small edits and then I think it'll be ready to merge 🚀

@@ -1,6 +1,22 @@
### main

* Introduce new experimental properties: `FillLayer.fillConstructBridgeGuardRail`, `FillLayer.fillBridgeGuardRailColor`, `FillLayer.fillTunnelStructureColor`, `CircleLayer.circleElevationReference`.
* Introduce `tapEvents` and `longPressEvents` API to the Annotation Managers to handle tap and long press event callbacks for annotations:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we mention the deprecation here as well?

maios added 2 commits June 26, 2025 10:55
@maios maios requested a review from pjleonard37 June 26, 2025 08:21
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.

🚀

@maios maios merged commit bc592b1 into main Jun 27, 2025
7 checks passed
@maios maios deleted the mai/MAPSFLT-192_annotation-ime branch June 27, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants