Skip to content

Commit 25f4866

Browse files
lyydikoigithub-actions[bot]
authored andcommitted
Map marker annotations positioning fix. (#6555)
GitOrigin-RevId: f9fbf6406b7c9aa77308e9e4e340a5405bf3e8ab
1 parent 2a7bc70 commit 25f4866

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Mapbox welcomes participation and contributions from everyone.
1010
* Expose experimental `MapboxMap.setStyleLayerPropertiesAsync` and `MapboxMap.setStyleLayerPropertyAsync` (also available through `Style`) to allow setting properties from a any thread and asynchronously.
1111

1212
## Bug fixes 🐞
13-
* MapboxTracing was deprecated and moved to package com.mapbox.common.
13+
* MapboxTracing was deprecated and moved to package com.mapbox.common.
14+
* Fixed incorrect positioning of map marker annotations, when coordinates do not change.
1415

1516
# 11.15.0
1617

maps-sdk/src/main/java/com/mapbox/maps/viewannotation/ViewAnnotationManagerImpl.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ internal class ViewAnnotationManagerImpl(
801801
viewAnnotationsLayout.addView(viewAnnotation.view, viewAnnotation.viewLayoutParams)
802802
updateVisibilityAndNotifyUpdateListeners(
803803
viewAnnotation,
804-
if (viewAnnotation.view.visibility == View.VISIBLE) {
804+
if (viewAnnotation.view.isVisible) {
805805
ViewAnnotationVisibility.VISIBLE_AND_POSITIONED
806806
} else {
807807
ViewAnnotationVisibility.INVISIBLE
@@ -816,11 +816,13 @@ internal class ViewAnnotationManagerImpl(
816816
viewAnnotation,
817817
ViewAnnotationVisibility.VISIBLE_AND_POSITIONED
818818
)
819+
notifyPositionListeners(viewAnnotation, descriptor, positionChanged = true)
820+
} else {
821+
notifyPositionListeners(viewAnnotation, descriptor)
819822
}
820823

821824
notifyAnchorListeners(viewAnnotation, descriptor)
822825
notifyAnchorCoordinateListeners(viewAnnotation, descriptor)
823-
notifyPositionListeners(viewAnnotation, descriptor)
824826
viewAnnotation.positionDescriptor = descriptor
825827

826828
// reorder Z index with the iteration order to keep selected annotations on top of others
@@ -852,9 +854,11 @@ internal class ViewAnnotationManagerImpl(
852854

853855
private fun notifyPositionListeners(
854856
viewAnnotation: ViewAnnotation,
855-
newPositionDescriptor: DelegatingViewAnnotationPositionDescriptor
857+
newPositionDescriptor: DelegatingViewAnnotationPositionDescriptor,
858+
positionChanged: Boolean = false,
856859
) {
857860
if (
861+
positionChanged ||
858862
viewAnnotation.positionDescriptor?.leftTopCoordinate != newPositionDescriptor.leftTopCoordinate ||
859863
viewAnnotation.positionDescriptor?.width != newPositionDescriptor.width ||
860864
viewAnnotation.positionDescriptor?.height != newPositionDescriptor.height

0 commit comments

Comments
 (0)