fix: Leistung etwas verbessert wegen Kabelstrecken anzeigen und ausblenden

This commit is contained in:
ISA
2025-08-22 14:44:54 +02:00
parent 8cf520bb2c
commit 0a3c4c208f
7 changed files with 33 additions and 41 deletions

View File

@@ -153,7 +153,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const [oms, setOms] = useState(null); // State für OMS-Instanz
// Flag, ob Nutzer die Polyline-Checkbox manuell betätigt hat
const userToggledPolyline = useRef(false);
// Nutzer-Flag global auf window, damit auch Redux darauf zugreifen kann
if (typeof window !== "undefined" && window.userToggledPolyline === undefined) {
window.userToggledPolyline = false;
}
//-----userRights----------------
const isRightsLoaded = useSelector(
@@ -305,7 +308,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// Callback für Checkbox-Umschaltung (Kabelstrecken)
const handlePolylineCheckboxChange = useCallback(
checked => {
userToggledPolyline.current = true;
if (typeof window !== "undefined") {
window.userToggledPolyline = true;
}
dispatch(setPolylineVisible(checked));
},
[dispatch]
@@ -1031,7 +1036,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
</div>
{GisStationsStaticDistrict && GisStationsStaticDistrict.Points?.length > 0 && (
<MapLayersControlPanel className="z-50" />
<MapLayersControlPanel
className="z-50"
handlePolylineCheckboxChange={handlePolylineCheckboxChange}
/>
)}
<CoordinateInput onCoordinatesSubmit={handleCoordinatesSubmit} />