diff --git a/src/util/markers.ts b/src/util/markers.ts index bf48a30..30ce92f 100644 --- a/src/util/markers.ts +++ b/src/util/markers.ts @@ -17,7 +17,7 @@ * limitations under the License. */ -import {Marker} from "leaflet"; +import {LeafletMouseEvent, Marker} from "leaflet"; import {DynmapMarker} from "@/dynmap"; import {DynmapIcon} from "@/leaflet/icon/DynmapIcon"; import {DynmapProjection} from "@/leaflet/projection/DynmapProjection"; @@ -35,6 +35,10 @@ export const createMarker = (options: DynmapMarker, projection: DynmapProjection minZoom: options.minZoom, }); + marker.on('click', (e: LeafletMouseEvent) => { + e.target._map.panTo(e.target.getLatLng()); + }); + if(options.popupContent) { marker.bindPopup(() => createPopup(options)); }