fix: Kabelstrecken werden ausgeblendet
This commit is contained in:
@@ -367,6 +367,14 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
//Tooltip an mouse position anzeigen für die Linien
|
||||
useEffect(() => {
|
||||
if (!map) return;
|
||||
console.log(
|
||||
"[MapComponent/useEffect] polylineVisible:",
|
||||
polylineVisible,
|
||||
"isTalasAllowed:",
|
||||
isTalasAllowed,
|
||||
"poiLayerVisible:",
|
||||
poiLayerVisible
|
||||
);
|
||||
|
||||
// Wenn TALAS nicht erlaubt ist, Polyline-Checkbox und Anzeige deaktivieren
|
||||
if (!isTalasAllowed) {
|
||||
@@ -381,6 +389,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
marker.remove();
|
||||
});
|
||||
cleanupPolylinesForMemory(polylines, map);
|
||||
console.log("[MapComponent/useEffect] Nach cleanupPolylinesForMemory, polylines:", polylines);
|
||||
|
||||
// Setze neue Marker und Polylinien mit den aktuellen Daten (asynchron!)
|
||||
const updatePolylines = async () => {
|
||||
@@ -442,9 +451,19 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
cleanupMarkers(markers, oms);
|
||||
setMarkers(newMarkers);
|
||||
setPolylines(newPolylines);
|
||||
console.log("[MapComponent/useEffect] setPolylines (sichtbar):", newPolylines);
|
||||
} else {
|
||||
// Entferne wirklich alle Polylinien-Layer von der Karte
|
||||
if (map) {
|
||||
map.eachLayer(layer => {
|
||||
if (layer instanceof L.Polyline) {
|
||||
map.removeLayer(layer);
|
||||
}
|
||||
});
|
||||
}
|
||||
cleanupPolylinesForMemory(polylines, map);
|
||||
setPolylines([]);
|
||||
console.log("[MapComponent/useEffect] setPolylines ([]), alle Polylinien entfernt");
|
||||
}
|
||||
};
|
||||
updatePolylines();
|
||||
|
||||
Reference in New Issue
Block a user