Files
myprojplanet_vite/src/utils/leaflet-extensions.ts

17 lines
419 B
TypeScript
Raw Normal View History

import L from 'leaflet';
// Estendi il prototipo del marker
L.Marker.prototype._animateZoom = function (opt: { zoom: number; center: L.LatLng }) {
// Assicurati che _map esista
if (!this._map) {
return;
}
// Calcola la nuova posizione del marker
const pos = this._map._latLngToNewLayerPoint(this._latlng, opt.zoom, opt.center).round();
// Imposta la posizione del marker
this._setPos(pos);
};