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

[compose] get annotationManager from PointAnnotationGroup #2357

Conversation

hiroaki404
Copy link

@hiroaki404 hiroaki404 commented Apr 29, 2024

for get featureId to use ViewAnnotation

Summary of changes

It doesn't work when using the combination of PointAnnotationGroup clustering and ViewAnotation.

When creating ViewAnnotationOptions, you can specify the featureId in annotatedLayerFeature to associate it with PointAnnotation. At this time, featureId is obtained from the Annotation as the return value when calling PointAnnotation.create().

However, when using the Copmose Extension, the PointAnnotationManager is hidden, so the annotation ID cannot be obtained.

As a workaround, you can remember PointAnnotationManager and access annotations property of PointAnnotationManager to get the annotation ID when needed.

Currently, annotation IDs are randomly generated, but another method is to specify an ID and create an annotation. However, I think this method requires a large scale of change.

Please consider the contents.

User impact (optional)

Pull request 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. If tests were not written, please explain why.
  • Optimize code for java consumption (@JvmOverloads, @file:JvmName, etc).
  • Add example if relevant.
  • Document any changes to public APIs.
  • Run make update-api to update generated api files, if there's public API changes, otherwise the verify-api-* CI steps might fail.
  • Update CHANGELOG.md or use the label 'skip changelog', otherwise check changelog CI step will fail.
  • If this PR is a v10.[version] release branch fix / enhancement, merge it to main firstly and then port to v10.[version] release branch.

Fixes: #2344

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

@hiroaki404 hiroaki404 requested a review from a team as a code owner April 29, 2024 09:47
@CLAassistant
Copy link

CLAassistant commented Apr 29, 2024

CLA assistant check
All committers have signed the CLA.

gj-loitp pushed a commit to gj-loitp/lib_mapbox-maps-android that referenced this pull request May 4, 2024
…`. (mapbox#2357)

This reverts commit 848bc996610213ab8101ba2bd601a6d124513d5e.

Fix changelog.
@@ -90,6 +92,7 @@ public fun PointAnnotationGroup(
iconTranslateAnchor: IconTranslateAnchor? = null,
textTranslate: List<Double>? = null,
textTranslateAnchor: TextTranslateAnchor? = null,
onAnnotationManagerCreated: (PointAnnotationManager) -> Unit = {},
Copy link
Member

Choose a reason for hiding this comment

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

Hey @hiroaki404 , thanks for contributing. With the proposed approach, I think you still cannot get the annotation id, as the annotation is supposed to be created by compose and you should not directly call PointAnnotationManager.create().
I think we'd go with exposing the feature id setter in the AnnotationOptions class, as it's more friendly in compose context and also align with iOS implementation. I have created a internal ticket for this feature.

Copy link
Author

Choose a reason for hiding this comment

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

I think we'd go with exposing the feature id setter in the AnnotationOptions class, as it's more friendly in compose context and also align with iOS implementation. I have created a internal ticket for this feature.

If that's possible, I think it's better too. Thank you!

@hiroaki404 hiroaki404 closed this May 8, 2024
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.

[Compose] - AnnotatedLayerFeature not working in ViewAnnotation
3 participants