Skip to content

Commit cc1a0d9

Browse files
Programmeisterdkhawk
authored andcommitted
Fix: #1424 - Added zIndex to markerOptions in onBeforeClusterRendered and onBeforeClusterItemRendered
1 parent f3d7217 commit cc1a0d9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/src/main/java/com/google/maps/android/clustering/view/DefaultClusterRenderer.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,9 @@ protected void onBeforeClusterItemRendered(@NonNull T item, @NonNull MarkerOptio
836836
} else if (item.getSnippet() != null) {
837837
markerOptions.title(item.getSnippet());
838838
}
839+
if (item.getZIndex() != null) {
840+
markerOptions.zIndex(item.getZIndex());
841+
}
839842
}
840843

841844
/**
@@ -906,6 +909,13 @@ protected void onClusterItemUpdated(@NonNull T item, @NonNull Marker marker) {
906909
protected void onBeforeClusterRendered(@NonNull Cluster<T> cluster, @NonNull MarkerOptions markerOptions) {
907910
// TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
908911
markerOptions.icon(getDescriptorForCluster(cluster));
912+
ArrayList<T> items = new ArrayList<>(cluster.getItems());
913+
if (!items.isEmpty()) {
914+
Float zIndex = items.get(0).getZIndex();
915+
if (zIndex != null) {
916+
markerOptions.zIndex(zIndex);
917+
}
918+
}
909919
}
910920

911921
/**

0 commit comments

Comments
 (0)