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

Change cluster color when clicked #1085

Open
5 tasks done
FedericoChavazza opened this issue Jan 17, 2023 · 0 comments
Open
5 tasks done

Change cluster color when clicked #1085

FedericoChavazza opened this issue Jan 17, 2023 · 0 comments

Comments

@FedericoChavazza
Copy link

FedericoChavazza commented Jan 17, 2023

  • I'm reporting a bug, not asking for help
  • I'm sure this is a Leaflet.MarkerCluster code issue, not an issue with my own code nor with the framework I'm using (Cordova, Ionic, Angular, React…)
  • I've searched through the issues to make sure it's not yet reported

How to reproduce

I've been having some trouble lately trying to implement a className change when clicking a specific cluster (all I wanna do is to change the color of the cluster once is clicked). The reason why this happens is because the class itself does not persist, it changes on every cluster render. I tried to change the className manually by using the "clusterclick" event (did not work), and using the iconCreateFunction too (did not work either) because there is no way to see if that cluster was clicked or not. For some reason, zooming in or zooming out changes the leaflet_id too, so idk what to dooo :,(

  • Leaflet version I'm using: ^1.8.0
  • Leaflet.MarkerCluster version I'm using: ^1.5.3
  • Browser (with version) I'm using: Google Chrome, using react too
  • OS/Platform (with version) I'm using:

image

the change class idea

image

What behaviour I'm expecting and which behaviour I'm seeing

the cluster to change color once is clicked

Minimal example reproducing the issue

  • this example is as simple as possible
  • this example does not rely on any third party code

Using http://leafletjs.com/edit.html or any other jsfiddle-like site.

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

1 participant