feat: Recoil-State polylineEventsDisabledState durch Redux ersetzt
- Migration von Recoil zu Redux abgeschlossen für Polyline-Interaktionsstatus - `MapComponent.js` verwendet jetzt Redux `useSelector` und `dispatch(setDisabled(...))` - `initializeMap.js` bekommt Callback-Funktion zur Steuerung des Redux-Status - Redux-Slice `polylineEventsDisabledSlice.js` mit Actions `setDisabled`, `toggleDisabled` integriert - Hinweis: `useCreateAndSetDevices.js` verwendet noch `useRecoilState`, muss refaktoriert werden
This commit is contained in:
@@ -44,7 +44,6 @@ import { gisSystemStaticState } from "../../redux/slices/webService/gisSystemSta
|
||||
import { selectMapLayersState } from "../../redux/slices/mapLayersSlice";
|
||||
import { selectedAreaState } from "../../redux/slices/selectedAreaSlice.js";
|
||||
import { zoomTriggerState } from "../../redux/slices/zoomTriggerSlice.js";
|
||||
import { polylineEventsDisabledState } from "../../redux/slices/polylineEventsDisabledSlice.js";
|
||||
import { polylineLayerVisibleState } from "../../redux/slices/polylineLayerVisibleSlice.js";
|
||||
//--------------------------------------------
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
@@ -84,6 +83,7 @@ import useFetchPoiData from "./hooks/useFetchPoiData.js";
|
||||
import useRestoreMapSettings from "./hooks/useRestoreMapSettings";
|
||||
import { setSelectedPoi, clearSelectedPoi } from "../../redux/slices/selectedPoiSlice";
|
||||
import { setupDevices } from "../../utils/setupDevices";
|
||||
import { setDisabled } from "../../redux/slices/polylineEventsDisabledSlice";
|
||||
|
||||
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -215,7 +215,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
return [53.111111, 8.4625];
|
||||
}
|
||||
});
|
||||
const [polylineEventsDisabled, setPolylineEventsDisabled] = useRecoilState(polylineEventsDisabledState); // Recoil State
|
||||
const polylineEventsDisabled = useSelector((state) => state.polylineEventsDisabled.disabled);
|
||||
const allMarkers = [
|
||||
...talasMarkers,
|
||||
...eciMarkers,
|
||||
@@ -252,6 +252,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
const ulafMarkersLayerRef = useRef(null);
|
||||
const sonstigeMarkersLayerRef = useRef(null);
|
||||
const tkComponentsMarkersRef = useRef(null);
|
||||
useInitializeMap(map, mapRef, setMap, setOms, setMenuItemAdded, addItemsToMapContextMenu, hasRights, (value) => dispatch(setDisabled(value)));
|
||||
//---------------------------------------------------------------
|
||||
useEffect(() => {
|
||||
const params = new URL(window.location.href).searchParams;
|
||||
@@ -693,8 +694,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
useLayerVisibility(map, ulafMarkers, mapLayersVisibility, "ULAF", oms);
|
||||
//--------------------------------------------
|
||||
|
||||
useInitializeMap(map, mapRef, setMap, setOms, setMenuItemAdded, addItemsToMapContextMenu, hasRights, setPolylineEventsDisabled);
|
||||
|
||||
useEffect(() => {
|
||||
if (!gisSystemStaticLoaded || !map) return; // Sicherstellen, dass die Karte und Daten geladen sind
|
||||
|
||||
@@ -819,6 +818,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
// Prüfe, ob der editMode deaktiviert ist
|
||||
if (!editMode) {
|
||||
// Entferne alle Marker aus der Karte
|
||||
if (!map) return; // Sicherstellen, dass map existiert
|
||||
|
||||
bereicheMarkers.forEach((marker) => {
|
||||
if (map.hasLayer(marker)) {
|
||||
map.removeLayer(marker);
|
||||
|
||||
Reference in New Issue
Block a user