-
-
Notifications
You must be signed in to change notification settings - Fork 107
Open
Labels
Description
My project requires the following behavior
- Presentation of collocated markers in a cluster (like spiderfy)
- Click to select a marker in the collocated marker set - leave the marker set visible and selection presented.
- Clear spiderfy of collocated clusters with NO selected marker when map background is clicked.
- Keep spiderfy active for collocated cluster with a selected marker.
I've added this code to my MarkerClusterGroup to support the behaviors above:
eventHandlers={{
unspiderfied: (e) => {
if (e.markers.find(m => m.options.icon.options.className.includes("selected"))) {
e.cluster.spiderfy();
}
},
clusterclick: (e) => {
if (e.target._spiderfied) {
e.target.unspiderfy();
} else {
e.target.spiderfy();
}
},
}}>
My problem is that when I click a marker to select it, the e.cluster.spiderfy() call in the unspiderfied event handler does not render both of the cluster markers. It only renders 1 of the two (could be either) and the cluster marker remains presented as shown here:
I expect the cluster to look like this:
Note: This only happens when there are 2 markers in the cluster. 3 or more markers works as expected.

