import * as L from '@mapgis/leaflet'
// @link https://github.com/Raruto/leaflet-rotate
/**
* L.Tooltip
*/
const tooltipProto = L.extend({}, L.Tooltip.prototype)
L.Tooltip.include({
_updatePosition() {
if (!this._map._rotate) {
return tooltipProto._updatePosition.call(this)
}
let pos = this._map.latLngToLayerPoint(this._latlng)
pos = this._map.rotatedPointToMapPanePoint(pos)
this._setPosition(pos)
},
_animateZoom(e) {
if (!this._map._rotate) {
return tooltipProto._animateZoom.call(this, e)
}
let pos = this._map._latLngToNewLayerPoint(this._latlng, e.zoom, e.center)
pos = this._map.rotatedPointToMapPanePoint(pos)
this._setPosition(pos)
}
})