-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[question] cluster tooltip #495
Comments
no :( |
Something like: |
👍 |
Hi, I think you are looking for You could also have bound tooltips / labels statically on clusters (which are pre-computed markers in fact). But I am not sure the libraries proposed above by @danzel give you the possibility to recompute the text (if you want it "dynamic"?) every time the tooltip / label is revealed. By binding at each mouseover, you can emulate this re-computation easily. Hope this helps. |
Thanks a lot. I think understood your answer but I do not see how to create a tooltip on mouseover. I do not find such method in Leaflet. |
Salut, Please have a look at the 2 links given by danzel above. I used a similar technique in this example: http://ghybs.github.io/Leaflet.markercluster/hierarchical-tree-of-groups/index.html I actually bound static labels, given that my data no longer change after initialization (or I completely redraw the MCG). Hope this helps. |
I think @ghybs has been very helpful in this issue, closing it off. |
Thanks a lot @ghybs ! I'll have a try. |
I tried Leaflet.label. The working like a charm solution I found is:
Cheers. |
May I add this example into "Event" section off the README ?? Like you want. |
Now that tooltips have been merged leaflet core, I am wondering what the recommended approach to adding tooltips is. Currently, I'm doing something like:
Is there a better way to do it? |
This code seems still functional with Leaflet 1.4.0 and Leaflet.markercluster 1.4.1: L.markerClusterGroup.on('clustermouseover', function(ev) {
ev.propagatedFrom.bindTooltip('tooltip text', {sticky: true}).openTooltip();
}).on('clustermouseout', function(ev) {
ev.propagatedFrom.unbindTooltip();
}); Note: Either Another caveat is that with IE9, the tooltip is rapidly closed, potentially due to hovering over the tooltip element (which triggers clustermouseout). (This issue is also visible with tooltips on other layer elements, the tooltip.) If IE9 support is important (meh...), you could workaround that by setting tooltip options like: {
offset: [10, 0],
direction: 'right', // important, otherwise the offset could be applied in the wrong direction
sticky: true
} |
This overrides the default icon creation, doesn't it? I like the approach though, to specify the tooltip in the options object instead of in an event handler. |
hello. I would like to know if there is a way to bind a
on:hover
tooltip to the cluster marker.I tried using Bootstrap tooltip in the html parameter of the
iconCreateFunction
, but it doesn't work.Thank you
The text was updated successfully, but these errors were encountered: