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

Popup don't open manually if 2 marks have the exact coordinates #1095

Open
1 task done
WagdySamih opened this issue Oct 7, 2023 · 2 comments
Open
1 task done

Popup don't open manually if 2 marks have the exact coordinates #1095

WagdySamih opened this issue Oct 7, 2023 · 2 comments

Comments

@WagdySamih
Copy link

  • 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>
@WagdySamih WagdySamih changed the title Popup don't open if 2 marks have the exact coordinates Popup don't open manually if 2 marks have the exact coordinates Oct 9, 2023
@ManuDoni
Copy link

ManuDoni commented Dec 13, 2023

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.

@jakobkuehne
Copy link

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.

So you are using tooltip now as a popup? I will propably try that too, because the problem described by @WagdySamih
exists untill now... Or do you have any fix for the popup issue?

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

3 participants