# HG changeset patch # User Sascha L. Teichmann # Date 1626193745 -7200 # Node ID 8097ad2319f538597013e80e2439f039680bfeb8 # Parent 7d7b1bf53189646cb0b787b836f65c4e098d86a8 Backout Esc/click to stop operation. diff -r 7d7b1bf53189 -r 8097ad2319f5 client/src/components/KeyboardHandler.vue --- a/client/src/components/KeyboardHandler.vue Tue Jul 13 16:17:01 2021 +0200 +++ b/client/src/components/KeyboardHandler.vue Tue Jul 13 18:29:05 2021 +0200 @@ -1,7 +1,7 @@ @@ -70,37 +70,28 @@ } } }, - methods: { - closeCompareView() { - this.$store.commit("fairwayprofile/additionalSurvey", null); - }, - stopDrawing() { - this.$store.commit("map/lineToolEnabled", false); - this.$store.commit("map/polygonToolEnabled", false); - this.$store.commit("map/cutToolEnabled", false); - this.$store.commit("map/setCurrentMeasurement", null); - this.openLayersMaps.forEach(m => { - m.getLayer("DRAWTOOL") - .getSource() - .clear(); - }); - }, - stopOperation() { - if ( - this.lineToolEnabled || - this.polygonToolEnabled || - this.cutToolEnabled - ) { - this.stopDrawing(); - } else if (this.paneSetup.includes("COMPARESURVEYS")) { - this.closeCompareView(); - } - } - }, mounted() { window.addEventListener("keydown", e => { // Escape - if (e.key === "Esc" || e.key === "Escape") this.stopOperation(); + if (e.keyCode === 27) { + if ( + this.lineToolEnabled || + this.polygonToolEnabled || + this.cutToolEnabled + ) { + this.$store.commit("map/lineToolEnabled", false); + this.$store.commit("map/polygonToolEnabled", false); + this.$store.commit("map/cutToolEnabled", false); + this.$store.commit("map/setCurrentMeasurement", null); + this.openLayersMaps.forEach(m => { + m.getLayer("DRAWTOOL") + .getSource() + .clear(); + }); + } else if (this.paneSetup.includes("COMPARESURVEYS")) { + this.$store.commit("fairwayprofile/additionalSurvey", null); + } + } }); } };