googlemaps / googlemaps/js-markerclusterer

Allow option of zooming in just enough so that the markers are unclustered, as opposed to zooming in just on the clustered markers

Open
#745 2 comments 9 reactions 0 assignees View on GitHub
priority: p3 type: feature request
Dominant language
TypeScript
Stars
293
Forks
104
Avg merge
3m
Merged PRs (30d)
18

Description

For our implementation, we don't particularly want to zoom in all the way on the markers, it can be a bit annoying for how the map is used in our product. As a result when the cluster is clicked, you have to zoom back out some afterwards, even though the markers are still not clustered after zooming out.

I'd like an option for the library to allow you to zoom in just enough that is required to de-cluster. It seems like it could potentially be a straightforward addition, as you could just leverage the `getClusterExpansionZoom` function that already exists in [supercluster](https://www.npmjs.com/package/supercluster#methods).

The alternative for us would likely involve leveraging the supercluster library itself to find the required zoom value, and then using that value in an onClick handler for the clusters. But it feels a bit redundant to pass in the markers to this library, which invokes supercluster, and then we just do that again with the same markers on our end just to get a value that we pass back to this library. If markerclusterer gave us access to the instantiated supercluster, we could also simply leverage that to call the function ourselves, but markercluster seems to hide/abstract this away, and I'm not sure why. Even the clusters/markers that are returned from this library do not have all of the values on them that supercluster attaches to its return values, but rather maps over them a returns a slightly simpler object. I'm sure there's a reason for it, but from my perspective, the more information I potentially have access to, the more useful it is.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.