-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
- 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
- Leaflet version I'm using: 1.9.4
- Leaflet.MarkerCluster version I'm using: latest from master
- Browser (with version) I'm using: Firefox 121 (although it's not a browser related issue)
- OS/Platform (with version) I'm using: Windows 10
How to reproduce
- Create a map and add markerClusterGroup
- Create LayerControl with
L.Control.Layersand add to map - Add layerGroup to MCG and LayerControl
- Create new marker, add to layerGroup
- Hide the layer using the LayerControl
- Change the latlng of the marker to
map.getCenter()for example - The marker will re-appear despite the layer being hidden!
What behaviour I'm expecting and which behaviour I'm seeing
I've reproduced the same using the LayerControl demo, the marker did not re-appear using the same approach from above.
I found this to be the cause of the bug: https://github.com/Leaflet/Leaflet.markercluster/blob/master/src/MarkerClusterGroup.js#L716
This causes the layer to be re-added, without checking if it's added or not.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels