Skip to content

fix: zIndex for Clustering #1484

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -836,6 +837,9 @@ protected void onBeforeClusterItemRendered(@NonNull T item, @NonNull MarkerOptio
} else if (item.getSnippet() != null) {
markerOptions.title(item.getSnippet());
}
if (item.getZIndex() != null) {
markerOptions.zIndex(item.getZIndex());
}
}

/**
Expand Down Expand Up @@ -906,6 +910,13 @@ protected void onClusterItemUpdated(@NonNull T item, @NonNull Marker marker) {
protected void onBeforeClusterRendered(@NonNull Cluster<T> cluster, @NonNull MarkerOptions markerOptions) {
// TODO: consider adding anchor(.5, .5) (Individual markers will overlap more often)
markerOptions.icon(getDescriptorForCluster(cluster));
ArrayList<T> items = new ArrayList<>(cluster.getItems());
if (!items.isEmpty()) {
Float zIndex = items.get(0).getZIndex();
if (zIndex != null) {
markerOptions.zIndex(zIndex);
}
}
}

/**
Expand Down
Loading