Skip to content

Commit

Permalink
Merge Prevent editing geometries in readonly mode (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
danjov authored Aug 3, 2022
2 parents 0a584b5 + 1dd03f3 commit 0b65016
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ClientApp/src/components/BohrungForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ export default function BohrungForm(props) {
currentStandort={currentStandort}
currentForm={"bohrung"}
setCurrentBohrung={setCurrentBohrung}
readOnly={readOnly}
></DetailMap>
</AccordionDetails>
</Accordion>
Expand Down
4 changes: 2 additions & 2 deletions src/ClientApp/src/components/DetailMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 });
});
Expand Down

0 comments on commit 0b65016

Please sign in to comment.