Polyline tooltips seem inconsistent
See original GitHub issueHere are a bunch of polylines with tooltips bound to them: https://www.dropbox.com/s/1bwladr9kmr128e/leaflet-polyline-tooltip.mov
Note that the tooltips appear at the top-left of rectangular polylines, but at the center-left-ish? of non-rectangular ones.
I was trying to set the offset
of tooltips to be the center of the polylines, but since the offset added to the default position of the tooltip, and that default position seems inconsistent, it’s hard to add to.
Related, it looks like the tooltip.offset
option is meant to be in pixels, but that means you need to change it after every pan/zoom? Seems like it should be a lat/long instead, then it could be set once per layer.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Polyline mouseover event to display some sort of message ...
I have a map in which the polylines for any given vehicle route is displayed. These polylines can all display at once. I...
Read more >Read Leaflet Tips and Tricks | Leanpub
This might seem slightly confusing, but it's just a simple hierarchy which we can flesh out by doing the same thing for each...
Read more >3D slice BUG - Autodesk Community - AutoCAD
This inconsistency is what I referred to, loosely, as a "bug" and that it would seem more desirable to be consistent in operation....
Read more >Flyspray::QCAD Bugtracker: Tasklist
1865, QCAD (main), Bug Report, Low, Scaling polyline with width by negative factor removes . ... dark theme / invisible shortcuts in tool...
Read more >Issues · Inkscape / Inbox - GitLab
New Page margins field needs a good tooltip, concept is inconsistent in itself, comma doesn't work ... Implement poly-line connectors connecting to vertices....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I decided I’d rather have the tooltip at the mouse position, and follow the mouse. I was able to get that working. https://www.dropbox.com/s/ph7i6aiy6u3rezu/leaflet-polyline-tooltip-follow.mov
So really this bug should be “how do I position a tooltip with absolute coordinates?”, and the answer is “use
openTooltip(<LatLng> latlng?)
”. It just took a while to figure it out.Hi @endquote,
For the use case where you want the Tooltip to follow the mouse, it seems to me that the
sticky
option might be what you need: http://playground-leaflet.rhcloud.com/wele/1/edit?html,outputYou may also use it in combination with
offset
anddirection
options.