diff --git a/.env.development b/.env.development index e8255d536..aa1a85841 100644 --- a/.env.development +++ b/.env.development @@ -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 # basePath wird jetzt in public/config.json gepflegt # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.331 +NEXT_PUBLIC_APP_VERSION=1.1.332 diff --git a/.env.production b/.env.production index 455b96b44..bff09ed9e 100644 --- a/.env.production +++ b/.env.production @@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=false # basePath wird jetzt in public/config.json gepflegt # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.331 +NEXT_PUBLIC_APP_VERSION=1.1.332 diff --git a/components/area/hooks/useAreaMarkersLayer.js b/components/area/hooks/useAreaMarkersLayer.js index bf42cf60a..7d891e1c9 100644 --- a/components/area/hooks/useAreaMarkersLayer.js +++ b/components/area/hooks/useAreaMarkersLayer.js @@ -71,10 +71,11 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => { const data = await response.json(); + const editMode = localStorage.getItem("editMode") === "true"; const markers = data.map(item => { const marker = L.marker([item.x, item.y], { icon: customIcon, - draggable: true, + draggable: editMode, customType: "areaMarker", }); @@ -88,24 +89,26 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => { } ); - marker.on("dragend", async e => { - const { lat, lng } = e.target.getLatLng(); - try { - await dispatch( - updateAreaThunk({ - idLocation: item.idLocation, - idMap: item.idMaps, - newCoords: { x: lat, y: lng }, - }) - ).unwrap(); - if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") { - console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng }); + if (editMode) { + marker.on("dragend", async e => { + const { lat, lng } = e.target.getLatLng(); + try { + await dispatch( + updateAreaThunk({ + idLocation: item.idLocation, + idMap: item.idMaps, + newCoords: { x: lat, y: lng }, + }) + ).unwrap(); + 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; }); diff --git a/package-lock.json b/package-lock.json index 43382901c..f87265f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nodemap", - "version": "1.1.331", + "version": "1.1.332", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nodemap", - "version": "1.1.331", + "version": "1.1.332", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", diff --git a/package.json b/package.json index 01361bcc2..25a2b96a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodemap", - "version": "1.1.331", + "version": "1.1.332", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0",