fix: Area-Marker (Bereiche) können jetzt nur noch verschoben werden, wenn in localStorage der Wert "editMode" auf "true" gesetzt ist. Andernfalls sind sie nicht verschiebbar.
This commit is contained in:
@@ -24,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=true
|
|||||||
# z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen
|
# z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen
|
||||||
# basePath wird jetzt in public/config.json gepflegt
|
# basePath wird jetzt in public/config.json gepflegt
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.331
|
NEXT_PUBLIC_APP_VERSION=1.1.332
|
||||||
|
|||||||
@@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=false
|
|||||||
# basePath wird jetzt in public/config.json gepflegt
|
# basePath wird jetzt in public/config.json gepflegt
|
||||||
|
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.331
|
NEXT_PUBLIC_APP_VERSION=1.1.332
|
||||||
|
|||||||
@@ -71,10 +71,11 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => {
|
|||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
|
const editMode = localStorage.getItem("editMode") === "true";
|
||||||
const markers = data.map(item => {
|
const markers = data.map(item => {
|
||||||
const marker = L.marker([item.x, item.y], {
|
const marker = L.marker([item.x, item.y], {
|
||||||
icon: customIcon,
|
icon: customIcon,
|
||||||
draggable: true,
|
draggable: editMode,
|
||||||
customType: "areaMarker",
|
customType: "areaMarker",
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -88,24 +89,26 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
marker.on("dragend", async e => {
|
if (editMode) {
|
||||||
const { lat, lng } = e.target.getLatLng();
|
marker.on("dragend", async e => {
|
||||||
try {
|
const { lat, lng } = e.target.getLatLng();
|
||||||
await dispatch(
|
try {
|
||||||
updateAreaThunk({
|
await dispatch(
|
||||||
idLocation: item.idLocation,
|
updateAreaThunk({
|
||||||
idMap: item.idMaps,
|
idLocation: item.idLocation,
|
||||||
newCoords: { x: lat, y: lng },
|
idMap: item.idMaps,
|
||||||
})
|
newCoords: { x: lat, y: lng },
|
||||||
).unwrap();
|
})
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
).unwrap();
|
||||||
console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng });
|
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
||||||
|
console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng });
|
||||||
|
}
|
||||||
|
onUpdateSuccess?.(); // optionaler Callback
|
||||||
|
} catch (error) {
|
||||||
|
console.error("❌ Fehler beim Aktualisieren der Koordinaten:", error);
|
||||||
}
|
}
|
||||||
onUpdateSuccess?.(); // optionaler Callback
|
});
|
||||||
} catch (error) {
|
}
|
||||||
console.error("❌ Fehler beim Aktualisieren der Koordinaten:", error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return marker;
|
return marker;
|
||||||
});
|
});
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.331",
|
"version": "1.1.332",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.331",
|
"version": "1.1.332",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.331",
|
"version": "1.1.332",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user