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

Commit

Permalink
Listen for marker 'add' events so we can show static labels. fixes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtoye committed Aug 19, 2013
1 parent 6fa8c81 commit 672ebb2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Marker.Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ L.Marker.include({

this
.on('remove', this.hideLabel, this)
.on('move', this._moveLabel, this);
.on('move', this._moveLabel, this)
.on('add', this._onMarkerAdd, this);

this._hasLabelHandlers = true;
}
Expand All @@ -86,7 +87,8 @@ L.Marker.include({

this
.off('remove', this.hideLabel, this)
.off('move', this._moveLabel, this);
.off('move', this._moveLabel, this)
.off('add', this._onMarkerAdd, this);
}

this._hasLabelHandlers = false;
Expand All @@ -104,6 +106,12 @@ L.Marker.include({
return this.label;
},

_onMarkerAdd: function () {
if (this._labelNoHide) {
this.showLabel();
}
},

_addLabelRevealHandlers: function () {
this
.on('mouseover', this.showLabel, this)
Expand Down

0 comments on commit 672ebb2

Please sign in to comment.