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

Pass Features to the ClusterMarker component #30

Open
jasonleehodges opened this issue Apr 3, 2020 · 2 comments
Open

Pass Features to the ClusterMarker component #30

jasonleehodges opened this issue Apr 3, 2020 · 2 comments

Comments

@jasonleehodges
Copy link

Is your feature request related to a problem? Please describe.
The ClusterMarker component is only passed a few props - one of them being the count of points in the cluster so that it can be rendered as a label to the cluster. I have a need to click on that cluster and, in a separate pane, see a list of the points in that cluster. It would be nice to pass all the features in that cluster to the ClusterMarker so that they can be accessed. Then, to render the label, you simply need to show the length of the array of features.

Describe the solution you'd like
Pass the features to the ClusterMarker component as a prop.

Describe alternatives you've considered
I've tried accessing the supercluster directly through refs and doing a reverse lookup of the points based on their lat/long coordinates. However, this is really messy and the ref doesn't seem to update as I zoom into the map and the cluster breaks apart into smaller clusters. Seems it would be way easier and cleaner to pass the features directly as a prop.

@mb8z
Copy link

mb8z commented Apr 28, 2020

This is something I would really love to do as well – list the markers under one cluster. Would be an awesome feature!

@jasonleehodges
Copy link
Author

@Ancinek I ended up creating my own implementation of this supercluster feature using use-supercluster and I simply passed the supercluster to the custom marker along with the cluster id. By doing that I could call getLeaves() on the super cluster and pass it the cluster ID to get all the points in that cluster.

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

No branches or pull requests

2 participants