fix(devices): Duplikate im Kontextmenü "Station öffnen" behoben
- Mehrfaches Hinzufügen bei jedem Rechtsklick unterbunden - Kontextmenü-Initialisierung mit contextMenuCreated abgesichert - Datei: createAndSetDevices.js
This commit is contained in:
@@ -118,10 +118,31 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
|
||||
}
|
||||
};
|
||||
|
||||
let contextMenuCreated = false;
|
||||
|
||||
marker.on("contextmenu", (event) => {
|
||||
event.originalEvent?.preventDefault();
|
||||
marker.openPopup();
|
||||
addDeviceContextMenu(map, marker);
|
||||
|
||||
if (!contextMenuCreated) {
|
||||
contextMenuCreated = true;
|
||||
|
||||
marker.bindContextMenu({
|
||||
contextmenu: true,
|
||||
contextmenuWidth: 160,
|
||||
contextmenuItems: [
|
||||
{ separator: true },
|
||||
{
|
||||
text: "Station öffnen (Tab)",
|
||||
icon: "/img/screen_new.png",
|
||||
callback: () => {
|
||||
const link = `${window.location.origin}${basePath}/cpl.aspx?ver=35&kue=24&id=${station.IdLD}`;
|
||||
window.open(link, "_blank");
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
map.on("click", () => {
|
||||
|
||||
Reference in New Issue
Block a user