Seite neu laden wenn die Fehler kommt , aber wird kurz angezeigt

This commit is contained in:
Ismail Ali
2025-03-10 22:21:36 +01:00
parent cc716eb4e7
commit 6c7b372291
4 changed files with 47 additions and 14 deletions

View File

@@ -303,21 +303,27 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
polyline.setStyle({ weight: 14 });
const link = `${process.env.NEXT_PUBLIC_BASE_URL}cpl.aspx?ver=35&kue=24&id=${lineData.idLD}`;
console.log("Link der Linie:", link);
// console.log("Link der Linie:", link);
});
polyline.on("mouseout", (e) => {
polyline.setStyle({ weight: 3 });
console.log("🚀 Maus hat die Polyline verlassen - Warten auf Klick außerhalb des Menüs.");
// console.log("🚀 Maus hat die Polyline verlassen - Warten auf Klick außerhalb des Menüs.");
document.addEventListener("click", function handleOutsideClick(event) {
if (!event.target.closest(".leaflet-contextmenu")) {
console.log("🛑 Klick außerhalb des Kontextmenüs erkannt - Schließe Menü.");
store.dispatch(closePolylineContextMenu());
store.dispatch(forceCloseContextMenu());
if (window.map?.contextmenu) {
window.map.contextmenu.hide();
try {
store.dispatch(closePolylineContextMenu());
store.dispatch(forceCloseContextMenu());
if (window.map?.contextmenu) {
window.map.contextmenu.hide();
}
} catch (error) {
console.error("❌ Fehler beim Schließen des Kontextmenüs:", error);
window.location.reload(); // **Seite neu laden, wenn ein Fehler auftritt**
}
document.removeEventListener("click", handleOutsideClick);