Recoil Statefpr polylines and Devices in process

This commit is contained in:
ISA
2024-09-03 15:46:50 +02:00
parent 8a9216980a
commit e60ce2b354
4 changed files with 47 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import "leaflet.smooth_marker_bouncing";
import { toast } from "react-toastify";
import * as config from "../config/config.js";
import { disablePolylineEvents, enablePolylineEvents } from "./setupPolylines"; // Importiere die Funktion zum Deaktivieren der Polyline-Ereignisse
import { setPolylineEventsDisabled } from "../store/atoms/polylineEventsDisabledState"; // Importiere den Recoil-Atom-Zustand
// Funktion zum Bestimmen der Priorität basierend auf dem Icon-Pfad
const determinePriority = (iconPath, priorityConfig) => {
@@ -53,14 +54,29 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste
});
// Verwende das `contextmenu`-Ereignis für den Rechtsklick
marker.on("contextmenu", function (event) {
/* marker.on("contextmenu", function (event) {
if (event && event.preventDefault) {
event.preventDefault(); // Verhindert das Standard-Kontextmenü
}
disablePolylineEvents(window.polylines);
this.openPopup();
});
*/
marker.on("contextmenu", function (event) {
if (event && event.preventDefault) {
event.preventDefault(); // Verhindert das Standard-Kontextmenü
}
//setPolylineEventsDisabled(true);
disablePolylineEvents(window.polylines);
this.openPopup();
});
document.addEventListener("mouseout", function (event) {
if (event.relatedTarget === null || event.relatedTarget.nodeName === "BODY") {
//setPolylineEventsDisabled(false);
enablePolylineEvents(window.polylines, window.lineColors);
}
});
marker.on("mouseout", function () {
this.closePopup();
});