Mercurial > gemma
changeset 5442:8097ad2319f5 marking-single-beam
Backout Esc/click to stop operation.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 13 Jul 2021 18:29:05 +0200 |
parents | 7d7b1bf53189 |
children | 4046432ccc9d |
files | client/src/components/KeyboardHandler.vue |
diffstat | 1 files changed, 20 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <template> <transition name="fade"> <div class="notice" v-if="showNotice"> - <span @click="stopOperation">{{ noticeText }}</span> + <span>{{ noticeText }}</span> </div> </transition> </template> @@ -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); + } + } }); } };