Skip to content

Commit

Permalink
Tweak method for starting labels as hidden.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtoye committed Nov 3, 2013
1 parent 5bfa9c3 commit c69ea1d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions dist/leaflet.draw.css
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@
margin-top: -21px;
padding: 4px 8px;
position: absolute;
visibility: hidden;
white-space: nowrap;
z-index: 6;
}
Expand Down
14 changes: 6 additions & 8 deletions src/Tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ L.Tooltip = L.Class.extend({
this._map = map;
this._popupPane = map._panes.popupPane;

if (map.options.drawControlTooltips) {
this._container = L.DomUtil.create('div', 'leaflet-draw-tooltip', this._popupPane);
this._container.style.visibility = 'hidden';
}
this._container = map.options.drawControlTooltips ? L.DomUtil.create('div', 'leaflet-draw-tooltip', this._popupPane) : null;
this._singleLineLabel = false;
},

Expand Down Expand Up @@ -41,11 +38,12 @@ L.Tooltip = L.Class.extend({
},

updatePosition: function (latlng) {
var pos = this._map.latLngToLayerPoint(latlng);
var pos = this._map.latLngToLayerPoint(latlng),
tooltipContainer = this._container;

if (this._container) {
this._container.style.visibility = 'inherit';
L.DomUtil.setPosition(this._container, pos);
tooltipContainer.style.visibility = 'inherit';
L.DomUtil.setPosition(tooltipContainer, pos);
}

return this;
Expand All @@ -64,4 +62,4 @@ L.Tooltip = L.Class.extend({
}
return this;
}
});
});

0 comments on commit c69ea1d

Please sign in to comment.