Leaflet/Leaflet.label

Label not hiding

RussianFox opened this issue · 5 comments

Hovering my mouse over line, appear label, clicking on line, popup appear (under Label, above line), out my mouse from line, label not hiding.

Method two (I think it's the same problem)
Hovering my mouse over line, scroll mouse for pan map, out my mouse from line, label not hiding.

Hey @RussianFox, can you post some sample code to show us how you have implemented this label for your polylines?

I'm not 100% sure on this, but I think you need to use the addTo() method for each label you are binding.

Like so:

_imap.lines[nl.id][2].bindLabel('<b>' + escapeHtml(nl.name) + '</b><br>' + getHostname(_imap.lines[nl.id][0]) + '<-->' + getHostname(_imap.lines[nl.id][1])).addTo(_imap.map);

Unless I missed something and you are using addTo() somewhere else in your code for these lines?

If this does not resolve it, I would recommend you try creating a simpler example with just your lines and labels, test it, and if it works, build your program back up from that point piece-by-piece to see which component(s) may be interfering with the Leaflet.label events.

You may need to explicitly define mouseover and mouseout events for your polylines that call the showLabel() and hideLabel() methods.

hm.... i'm using addTo

so, i try debug and find this:

close: function () {
    var map = this._map;
    if (map) {

this._map is undefined on error.

Error occurs after the zoom and second mouseOver without mouseOut