fix: Die Anwendung verwendet jetzt ausschließlich den Redux-Slice (polylineLayerVisible.visible) für die Sichtbarkeit der Kabelstrecken (Polylines). Die Checkbox und die Anzeige der Linien sind damit immer synchron und reaktiv – unabhängig von localStorage.
This commit is contained in:
@@ -374,10 +374,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Prüfe Sichtbarkeit aus localStorage und Redux
|
||||
const localStoragePolylineVisible = localStorage.getItem("polylineVisible") === "true";
|
||||
const reduxPolylineLayerVisible = poiLayerVisible; // redux: polylineLayerVisible.visible
|
||||
|
||||
// Die Sichtbarkeit der Polylines hängt nur noch vom Redux-Slice ab
|
||||
// vorherige Marker & Polylinien vollständig bereinigen
|
||||
(Array.isArray(markers) ? markers : []).forEach(marker => {
|
||||
marker.remove();
|
||||
@@ -386,7 +383,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
// Setze neue Marker und Polylinien mit den aktuellen Daten (asynchron!)
|
||||
const updatePolylines = async () => {
|
||||
if (localStoragePolylineVisible && reduxPolylineLayerVisible) {
|
||||
if (polylineVisible) {
|
||||
const { markers: newMarkers, polylines: newPolylines } = await setupPolylines(
|
||||
map,
|
||||
linePositions,
|
||||
@@ -396,7 +393,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
tempMarker,
|
||||
currentZoom,
|
||||
currentCenter,
|
||||
polylineVisible // kommt aus Redux
|
||||
polylineVisible
|
||||
);
|
||||
|
||||
(Array.isArray(newPolylines) ? newPolylines : []).forEach((polyline, index) => {
|
||||
|
||||
Reference in New Issue
Block a user