fix: Marker-Duplikate & Spiderfy repariert | version 1.1.230
This commit is contained in:
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react";
|
||||
import L from "leaflet";
|
||||
import { createAndSetDevices } from "../utils/devices/createAndSetDevices";
|
||||
import { checkOverlappingMarkers } from "../utils/mapUtils";
|
||||
import plusRoundIcon from "../components/icons/devices/overlapping/PlusRoundIcon";
|
||||
import plusRoundIcon from "@/components/icons/devices/overlapping/PlusRoundIcon";
|
||||
|
||||
/**
|
||||
* Dynamisch GIS-System-Marker erstellen & Sichtbarkeit steuern.
|
||||
@@ -31,14 +31,27 @@ const useDynamicDeviceLayers = (map, GisSystemStatic, mapLayersVisibility, prior
|
||||
createAndSetDevices(
|
||||
IdSystem,
|
||||
newMarkers => {
|
||||
setMarkerStates(prev => ({ ...prev, [key]: newMarkers }));
|
||||
const oldMarkers = markerStates[key];
|
||||
|
||||
// ❌ NICHT direkt zur Karte hinzufügen
|
||||
// Sichtbarkeit folgt im 2. useEffect
|
||||
checkOverlappingMarkers(map, newMarkers, plusRoundIcon, oms);
|
||||
// Entferne alte Marker aus Karte und OMS
|
||||
if (oldMarkers && Array.isArray(oldMarkers)) {
|
||||
oldMarkers.forEach(marker => {
|
||||
if (map.hasLayer(marker)) {
|
||||
map.removeLayer(marker);
|
||||
}
|
||||
if (oms) {
|
||||
oms.removeMarker(marker);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Neue Marker setzen
|
||||
setMarkerStates(prev => ({ ...prev, [key]: newMarkers }));
|
||||
},
|
||||
GisSystemStatic,
|
||||
priorityConfig
|
||||
priorityConfig,
|
||||
undefined,
|
||||
oms
|
||||
);
|
||||
});
|
||||
}, [map, GisSystemStatic, priorityConfig]);
|
||||
|
||||
Reference in New Issue
Block a user