From 1dd03f36c5f6c10a3a3fb5ac77a9494cab409249 Mon Sep 17 00:00:00 2001 From: Daniel Jovanovic Date: Wed, 3 Aug 2022 11:12:00 +0200 Subject: [PATCH] Prevent editing geometries in readonly mode --- src/ClientApp/src/components/BohrungForm.js | 1 + src/ClientApp/src/components/DetailMap.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ClientApp/src/components/BohrungForm.js b/src/ClientApp/src/components/BohrungForm.js index 25647b4..40832aa 100644 --- a/src/ClientApp/src/components/BohrungForm.js +++ b/src/ClientApp/src/components/BohrungForm.js @@ -405,6 +405,7 @@ export default function BohrungForm(props) { currentStandort={currentStandort} currentForm={"bohrung"} setCurrentBohrung={setCurrentBohrung} + readOnly={readOnly} > diff --git a/src/ClientApp/src/components/DetailMap.js b/src/ClientApp/src/components/DetailMap.js index 3f868f3..966e774 100644 --- a/src/ClientApp/src/components/DetailMap.js +++ b/src/ClientApp/src/components/DetailMap.js @@ -14,7 +14,7 @@ import { Style, Circle, Fill, Stroke } from "ol/style"; import "ol/ol.css"; export default function DetailMap(props) { - const { bohrungen, currentStandort, currentForm, setCurrentBohrung } = props; + const { bohrungen, currentStandort, currentForm, setCurrentBohrung, readOnly } = props; const [map, setMap] = useState(); const [bohrungenLayer, setBohrungenLayer] = useState(); const [geometrie, setGeometrie] = useState(); @@ -62,7 +62,7 @@ export default function DetailMap(props) { }); // Allow editing of geometry if map is displayed in bohrung form. - if (currentForm === "bohrung") { + if (currentForm === "bohrung" && !readOnly) { initialMap.on("singleclick", function (evt) { setGeometrie({ type: "Point", coordinates: evt.coordinate }); });