bereich.png erstellt und bei editMode active marker.setZIndexOffset(1000);
This commit is contained in:
@@ -42,6 +42,7 @@ import useLineData from "../hooks/useLineData.js";
|
||||
//import { useCreateAndSetDevices } from "../hooks/useCreateAndSetDevices";
|
||||
import { useMapComponentState } from "../hooks/useMapComponentState";
|
||||
import { disablePolylineEvents, enablePolylineEvents } from "../utils/setupPolylines";
|
||||
import { updateLocation } from "../utils/updateBereichUtil";
|
||||
//--------------------------------------------
|
||||
import { currentPoiState } from "../redux/slices/currentPoiSlice.js";
|
||||
import { selectGisStationsStaticDistrict, setGisStationsStaticDistrict } from "../redux/slices/gisStationsStaticDistrictSlice";
|
||||
@@ -173,6 +174,17 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
});
|
||||
const [polylineEventsDisabled, setPolylineEventsDisabled] = useRecoilState(polylineEventsDisabledState); // Recoil State
|
||||
|
||||
const handleLocationUpdate = async (idLocation, idMap, newCoords) => {
|
||||
try {
|
||||
const result = await updateLocation(idLocation, idMap, newCoords);
|
||||
console.log("Erfolgreiche Aktualisierung:", result);
|
||||
|
||||
// Aktualisieren Sie Marker oder andere Elemente
|
||||
} catch (error) {
|
||||
console.error("Fehler beim Aktualisieren der Location:", error);
|
||||
}
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------
|
||||
|
||||
/* useEffect(() => {
|
||||
@@ -795,6 +807,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
// Bereichs-Marker basierend auf dynamischer URL laden
|
||||
const bereicheMarkers = useBereicheMarkersLayer(map, oms, bereichUrl);
|
||||
//const bereicheMarkers = useBereicheMarkersLayer(map, oms, editMode ? `/api/talas_v5_DB/bereich/readBereich?editMode=true` : `/api/talas_v5_DB/bereich/readBereich`);
|
||||
//const bereicheMarkers = useBereicheMarkersLayer(map, oms, "/api/talas_v5_DB/bereich/readBereich?m=12");
|
||||
|
||||
/* useEffect(() => {
|
||||
@@ -803,6 +816,19 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
console.log("Bereiche-Markierungen geladen:", bereicheMarkers);
|
||||
}
|
||||
}, [map, oms, bereicheMarkers]); */
|
||||
useEffect(() => {
|
||||
const editMode = localStorage.getItem("editMode") === "true";
|
||||
|
||||
bereicheMarkers.forEach((marker) => {
|
||||
if (editMode) {
|
||||
marker.dragging.enable();
|
||||
marker.setZIndexOffset(1000); // Marker nach oben setzen
|
||||
} else {
|
||||
marker.dragging.disable();
|
||||
marker.setZIndexOffset(0); // Standard-Z-Index
|
||||
}
|
||||
});
|
||||
}, [bereicheMarkers]);
|
||||
|
||||
//----------------------------------
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user