Leaflet.markercluster
Leaflet.markercluster copied to clipboard
Popup don't open manually if 2 marks have the exact coordinates
- [x] I've searched through the issues to make sure it's not yet reported
- Leaflet version: 4.2.1
- Leaflet.MarkerCluster version: 2.1.0
- Browser (with version): Chrome - 117
- OS/Platform: Ubuntu 20.04
How to reproduce
Try to have marks with the exact position same lat and long Try to open the popup from any outside source for the same duplicated position popup
What behavior I'm expecting and which behavior I'm seeing
The popup doesn't open Note: The code below works totally fine if there is no clustering
<MarkerClusterGroup
iconCreateFunction={createClusterCustomIcon}
maxClusterRadius={30}
spiderfyOnMaxZoom
polygonOptions={{
fillColor: '#ffffff',
color: '#7DD68E',
weight: 5,
opacity: 1.0,
fillOpacity: 0.8,
}}
showCoverageOnHover={true}
>
{markers.map((marker, index) => (
<Marker
position={marker.coordinates}
key={index}
ref={myRefs.current[index]}
icon={greenIcon(marker?.markerImage || '')}
eventHandlers={{
click: () => {
setLocalSelectedLocation({
position: marker.coordinates,
user: marker.user,
});
},
}}
>
<Popup
key={index}
className={styles.popup_container}
offset={[10, 5]}
>
{localSelectedLocation && (
<div> any thing </div>
)}
</Popup>
</Marker>
))}
</MarkerClusterGroup>
Hello, I have the same problem. Have you solved it in some way?
Update: I had this problem because the Popup was used like a tooltip (showing the popup and setting a state on a onMouseOver
). I changed it to a real Tooltip component and now I can click on the "spiderfied" marker without issue.