fix: GMA Tooltip Kontextmenü funktioniert

This commit is contained in:
ISA
2024-12-12 20:31:37 +01:00
parent 4f154e262a
commit 3f2786849a

View File

@@ -3,20 +3,21 @@ import { addContextMenuToMarker } from "../../utils/addContextMenuToMarker";
import { addItemsToMapContextMenu } from "../../components/useMapContextMenu"; // Importiere die Funktion import { addItemsToMapContextMenu } from "../../components/useMapContextMenu"; // Importiere die Funktion
const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isVisible) => { const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isVisible) => {
const zoomIn = (e, map) => { const zoomIn = (map, latlng) => {
if (!map) { if (!map) {
console.error("map is not defined in zoomIn"); console.error("map is not defined in zoomIn");
return; return;
} }
const currentZoom = map.getZoom(); const currentZoom = map.getZoom();
if (currentZoom < 14) { if (currentZoom < 14) {
map.flyTo(e.latlng, 14); map.flyTo(latlng, 14);
localStorage.setItem("mapZoom", 16); localStorage.setItem("mapZoom", 14);
localStorage.setItem("mapCenter", JSON.stringify(map.getCenter())); localStorage.setItem("mapCenter", JSON.stringify(map.getCenter()));
} }
}; };
const zoomOut = (map) => { const zoomOut = (map) => {
if (!map) { if (!map) {
@@ -137,7 +138,10 @@ const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isV
{ {
text: "Reinzoomen", text: "Reinzoomen",
icon: "img/zoom_in.png", icon: "img/zoom_in.png",
callback: () => zoomIn(map), callback: () => {
const latlng = marker.getLatLng(); // Hole die Koordinaten direkt vom Marker
zoomIn(map, latlng);
},
}, },
{ {
text: "Rauszoomen", text: "Rauszoomen",