-
-
Notifications
You must be signed in to change notification settings - Fork 264
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
Android annotations: click, long-click and dragging #1737
Android annotations: click, long-click and dragging #1737
Conversation
...TestApp/src/main/java/org/maplibre/android/testapp/activity/annotation/BulkMarkerActivity.kt
Outdated
Show resolved
Hide resolved
@@ -56,18 +55,16 @@ class PolygonActivity : AppCompatActivity(), OnMapReadyCallback { | |||
override fun onMapReady(map: MapLibreMap) { | |||
maplibreMap = map | |||
map.setStyle(Style.getPredefinedStyle("Streets")) | |||
map.setOnPolygonClickListener { polygon: Polygon -> | |||
/*map.setOnPolygonClickListener { polygon: Fill -> | |||
Toast.makeText( | |||
this@PolygonActivity, | |||
"You clicked on polygon with id = " + polygon.id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this example be revived?
map.setOnPolygonClickListener
still works right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map.setOnPolygonClickListener
still works right?
Actually, no, this is not covered by the spec. Probably it should still be added – I think it would be best to do this at the same time that we add functionality for users being able to add managers to MapLibreMap
(which, now to notice, is not actually covered by any of the existing issues. I'd suggest to do it after automatic grouping is implemented since we wanted a method that adds a new manager above a specific z layer).
I reinstated the click listener by adding it to the individual polygon.
The dragging issue seems to get progressively worse with more markers. Are you iterating over all the markers to handle the drag event? |
c92b39a
to
96ebea9
Compare
if (annotation is Symbol) annotation.icon?.let { style?.addImage(it.image.toString(), it.image) } | ||
if (annotation is Line) annotation.pattern?.let { style?.addImage(it.toString(), it) } | ||
if (annotation is Fill) annotation.pattern?.let { style?.addImage(it.toString(), it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you iterating over all the markers to handle the drag event?
@louwers No, like previously, we are only calling AnnotationManager.queryMapForFeatures
one time to get the annotation to be dragged when dragging begins. What I considered could be a bottleneck is that we are re-adding the icon image to the map every update. However, commenting out the lines marked above does not noticeably improve the situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the performance this bad before too?
Let's have a chat on Slack when you have time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some performance issues, but it's unclear if they are regressions or not.
I spoke with @fynngodau and we will merge this for now and when the project is complete we can do another pass for performance QA.
96ebea9
to
b940c21
Compare
(Tests fail because we didn't have the render tests at the time. I'll try merging main into |
Android annotations API proposal implementation PR as a part of #1491. Closes #1634. To be merged after #1724.
DraggableAnnotationController
have been updated, and pass.Annotation
→KAnnotation
AnnotationContainer
→KAnnotationContainer