Skip to content

Conversation

Programmeister
Copy link
Contributor

Add zIndex to markerOptions in onBeforeClusterRendered and onBeforeClusterItemRendered

Fixes #1424

@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
Contributor 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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @Programmeister .

That solutions sounds a bit better than the current iterator one IMO.

@Programmeister
Copy link
Contributor Author

Hello @dkhawk , @kikoso,

I would appreciate it if you could help me complete this PR.

Are there any further steps required to complete the merge?

…erRendered and onBeforeClusterItemRendered
kikoso and others added 2 commits August 20, 2025 12:02
* feat: added ContinuousZoomEuclideanAlgorithm

* feat: added ContinuousZoomEuclideanAlgorithm

* feat: added ContinuousZoomEuclideanAlgorithm

* feat: replaced methods in NonHierarchicalDistanceBasedAlgorithm.java

* feat: refactored to create ContinuousZoomEuclideanCentroidAlgorithm.java
# [3.15.0](googlemaps/android-maps-utils@v3.14.0...v3.15.0) (2025-08-19)

### Features

* added ContinuousZoomEuclideanCentroidAlgorithm ([googlemaps#1559](googlemaps#1559)) ([b781ff8](googlemaps@b781ff8))
@dkhawk
Copy link
Contributor

dkhawk commented Aug 20, 2025

Sorry. This PR got corrupted somehow beyond my ability to fix. I created a new PR with the original change here: #1566. Thank you for your contribution!

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
4 participants