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

fix: zIndex for Clustering #1484

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Programmeister
Copy link

Add zIndex to markerOptions in onBeforeClusterRendered and onBeforeClusterItemRendered

Fixes #1424

…erRendered and onBeforeClusterItemRendered
@kikoso kikoso changed the title Fix: #1424 zIndex for Clusterung fix: #1424 zIndex for Clustering Mar 10, 2025
@kikoso kikoso changed the title fix: #1424 zIndex for Clustering fix: zIndex for Clustering Mar 10, 2025
@@ -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));
Iterator<T> iterator = cluster.getItems().iterator();
Copy link
Contributor

Choose a reason for hiding this comment

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

This code next more explanation. What is the goal of this code and how does it work?

It also strike me as very odd. I am not used to seeing an iterator w/o a loop. This has a strange code smell to it. If the intent is to only use the second element of the cluster, this seems like a very strange way to go about it.

Copy link
Author

Choose a reason for hiding this comment

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

Cluster.getItems() returns Collection.

Since there are no methods like get in the Collection interface, I use iterator to get the first element.

I see another way to do this:
ArrayList<T> items = new ArrayList<>(cluster.getItems());

Do you think this option would be clearer?

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.

Z-index not working
2 participants