Fix tooltip zoomanimation (fix #4744) (#4765)

Actually something I forgot to port from umap-project/Leaflet.Label
This commit is contained in:
Yohan Boniface 2016-08-02 16:38:08 +02:00 committed by Vladimir Agafonkin
parent 9720d769a4
commit 6dec6660b2

View File

@ -112,9 +112,8 @@ L.Tooltip = L.DivOverlay.extend({
_adjustPan: function () {}, _adjustPan: function () {},
_updatePosition: function () { _setPosition: function (pos) {
var map = this._map, var map = this._map,
pos = map.latLngToLayerPoint(this._latlng),
container = this._container, container = this._container,
centerPoint = map.latLngToContainerPoint(map.getCenter()), centerPoint = map.latLngToContainerPoint(map.getCenter()),
tooltipPoint = map.layerPointToContainerPoint(pos), tooltipPoint = map.layerPointToContainerPoint(pos),
@ -146,6 +145,11 @@ L.Tooltip = L.DivOverlay.extend({
L.DomUtil.setPosition(container, pos); L.DomUtil.setPosition(container, pos);
}, },
_updatePosition: function () {
var pos = this._map.latLngToLayerPoint(this._latlng);
this._setPosition(pos);
},
setOpacity: function (opacity) { setOpacity: function (opacity) {
this.options.opacity = opacity; this.options.opacity = opacity;
@ -155,12 +159,8 @@ L.Tooltip = L.DivOverlay.extend({
}, },
_animateZoom: function (e) { _animateZoom: function (e) {
var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center), offset; var pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center);
if (this.options.offset) { this._setPosition(pos);
offset = L.point(this.options.offset);
pos = pos.add(offset);
}
L.DomUtil.setPosition(this._container, pos);
}, },
_getAnchor: function () { _getAnchor: function () {