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

How to show a tooltip for the antPath? #173

Open
2 of 6 tasks
magicarm22 opened this issue Oct 1, 2022 · 0 comments
Open
2 of 6 tasks

How to show a tooltip for the antPath? #173

magicarm22 opened this issue Oct 1, 2022 · 0 comments

Comments

@magicarm22
Copy link

Type:

  • bug
  • feature
  • enhancement
  • question

Environment:

  • OS: Windows
  • Browser: Google Chrome
  • Library Version: 1.3.0

I'm going to open a PR:

  • yes
  • no

Description:
Hello! I use your library for drawing paths between markers. It works well. But how can I draw a tooltip, when I click on your antPath or when my mouse is over the line? I tried something like this:

<AntPath key={index} positions={information['coords']} options={{color: 'red', weight: 3, dashArray: [5, 40]}}>
   <Tooltip sticky>
       Bla bla bla
   </Tooltip>
</AntPath>

Where Tooltip is from react-leaflet library. Also, I tried to use the MUI tooltip, but it doesn't work too.
My AntPath looks like this:

const AntPath = (p) => {
    const context = useLeafletContext()
    useEffect(() => {
        let antPolyline = antPath(p.positions, p.options);
        context.map.addLayer(antPolyline)
        return () => {
            context.map.removeLayer(antPolyline)
        }
    })
    return null
}

And AntPath works well.
image

So, the main question is how to create a tooltip for the antPath?
Thanks for your help and for your fantastic library!

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

1 participant