Permalink
Browse files

Tweak method for starting labels as hidden.

  • Loading branch information...
1 parent 5bfa9c3 commit c69ea1dbcd8bd5ba84e6ed0c6b14b395bb6881ed @jacobtoye jacobtoye committed Nov 3, 2013
Showing with 7 additions and 8 deletions.
  1. +1 −0 dist/leaflet.draw.css
  2. +6 −8 src/Tooltip.js
@@ -182,6 +182,7 @@
margin-top: -21px;
padding: 4px 8px;
position: absolute;
+ visibility: hidden;
white-space: nowrap;
z-index: 6;
}
View
@@ -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;
},
@@ -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;
@@ -64,4 +62,4 @@ L.Tooltip = L.Class.extend({
}
return this;
}
-});
+});

0 comments on commit c69ea1d

Please sign in to comment.