Sattion öffnen (Tab) für polylines und Geräte funktioniert nicht zu 100% muss noch optimiert werden

This commit is contained in:
ISA
2024-09-03 08:50:58 +02:00
parent 03de1ab43e
commit 46a9f05894
3 changed files with 72 additions and 30 deletions

View File

@@ -6,6 +6,7 @@ import "leaflet-contextmenu/dist/leaflet.contextmenu.css";
import * as urls from "../config/urls.js";
import * as layers from "../config/layers.js";
import { addContextMenuToMarker, openInNewTab } from "../utils/contextMenuUtils";
import { disablePolylineEvents, enablePolylineEvents } from "./mapFeatures"; // Importiere die Funktionen
export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItemsToMapContextMenu, hasRights) => {
const offlineTileLayer = urls.OFFLINE_TILE_LAYER;
@@ -45,10 +46,10 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
console.log("Opening polyline link:", storedLink);
window.open(storedLink, "_blank");
}
//} else if (lastElementType === "marker") {
} else {
const clickedMarker = e.relatedTarget;
openInNewTab(e, clickedMarker);
console.log("Opening marker link:", clickedMarker.options.link);
}
},
},
@@ -67,6 +68,11 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
setMap(initMap);
setOms(overlappingMarkerSpiderfier);
// Polyline-Ereignisse aktivieren, wenn das Kontextmenü geschlossen wird
initMap.on("contextmenu.close", function () {
enablePolylineEvents(window.polylines, window.lineColors);
});
initMap.on("zoomend", function () {
if (initMap.getZoom() > 15) {
initMap.setZoom(15);