Station öffnen (Tab) funktioniert für polylines und Stationen(Markers)

This commit is contained in:
ISA
2024-09-02 20:20:22 +02:00
parent 17a8075d73
commit 8500be8d5a
3 changed files with 27 additions and 26 deletions

View File

@@ -52,6 +52,7 @@ export const setupMarkers = async (
id: location.idPoi,
name: location.name,
description: location.description,
link: location.link, // Marker-specific link
}).bindContextMenu({
contextmenu: true,
contextmenuWidth: 140,
@@ -91,6 +92,7 @@ export const setupMarkers = async (
this.openPopup();
localStorage.setItem("lastElementType", "marker");
localStorage.setItem("markerLink", this.options.link); // Store the marker-specific link
});
marker.on("mouseout", function () {

View File

@@ -45,11 +45,10 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
console.log("Opening polyline link:", storedLink);
window.open(storedLink, "_blank");
}
} else if (lastElementType === "marker") {
const clickedItem = e.relatedTarget;
if (clickedItem instanceof L.Marker) {
openInNewTab(e, clickedItem);
}
//} else if (lastElementType === "marker") {
} else {
const clickedMarker = e.relatedTarget;
openInNewTab(e, clickedMarker);
}
},
},