-
Notifications
You must be signed in to change notification settings - Fork 1k
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
RefreshClusters VS singleMarkerMode: true #581
Comments
Hi, Good point. We could add this functionality, or we could take the opportunity to re-visit this option I guess the less effort rule will guide us towards the first option... |
Well, I do not know leaflet that much but to me it seems strange that you cannot use singleMarkerMode with disableClusteringAtZoom. Personally I would like to disable mark clusters on maximum zoom - I do not like spidering functionality. What I try to achieve is to have fully dynamic styling of markers and marker clusters. Let say that you mark bridges on a map. Each bridge has bad or good state (or yet another state). Each state of the bridge has a particular styling (bad state == red colour, good state == green colour). The mark clusters should be styled according to the worst state of bridges inside that cluster. State of the bridges can change at any time and should be immediately reflected in the map. How would you solve such particular case? I use singleMarkerMode and style both markers and marker clusters according to the bridge states. |
The "incompatibility" between It is understandable to do it that way, and it sounds to fit for your use case as well: it conveniently avoids having to style your individual markers, while using the exact same If using If on the contrary your individual markers needed differentiated styling (shape of the bridge let's say), then you would prefer normal mode, which is already covered by So if my understanding is correct, there is no strong need for real clusters containing single markers, and the trick to style the markers with the same Is that what you mean? I think the situation would be more clear if the option Does that make sense? |
Following issue Leaflet#581, improved refreshClusters() method so that it detects singleMarkerMode and re-draws all passed markers as well, not only parent clusters. Also created the singleMarkerModeSpec test suite to test singleMarkerMode option, added an extra test in RefreshSpec test suite to cover this case, and added the new suite into spec/index.
Hi, thanks for the explanation. I have just tested you latest commit and it works perfectly! Thanks a lot for your help. |
Hi,
I am glad it solved your issue.
I must admit I totally missed that use case, thank you for reporting it.
|
When using
singleMarkerMode: true
, therefreshClusters
function should also runiconCreateFunction
for all the end markers, not only cluster markers.As it is now the cluster markers are updated but normal markers are not updated.
The text was updated successfully, but these errors were encountered: