Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Label not hiding #118

Open
RussianFox opened this issue May 19, 2015 · 5 comments
Open

Label not hiding #118

RussianFox opened this issue May 19, 2015 · 5 comments

Comments

@RussianFox
Copy link

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

@RussianFox RussianFox changed the title Label not hide Label not hiding May 19, 2015
@RussianFox
Copy link
Author

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.

@MattSidor
Copy link

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

@RussianFox
Copy link
Author

@MattSidor
Copy link

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.

@RussianFox
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants