Skip to content

How to show a tooltip for the antPath? #173

@magicarm22

Description

@magicarm22

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions