Mercurial > gemma
diff client/src/components/toolbar/Toolbar.vue @ 3062:87e0422cffa7
client: draw/cut tools work now with multiple maps
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 16 Apr 2019 12:49:29 +0200 |
parents | 051a3f446ac2 |
children | a54216a0193d |
line wrap: on
line diff
--- a/client/src/components/toolbar/Toolbar.vue Tue Apr 16 12:39:55 2019 +0200 +++ b/client/src/components/toolbar/Toolbar.vue Tue Apr 16 12:49:29 2019 +0200 @@ -116,7 +116,7 @@ * Author(s): * Markus Kottländer <markus.kottlaender@intevation.de> */ -import { mapState, mapGetters } from "vuex"; +import { mapState } from "vuex"; export default { name: "toolbar", @@ -131,23 +131,23 @@ Pdftool: () => import("./Pdftool") }, computed: { - ...mapState("map", ["lineTool", "polygonTool", "cutTool"]), - ...mapState("application", ["expandToolbar", "panes"]), - ...mapGetters("map", ["openLayersMap"]) + ...mapState("map", ["openLayersMaps"]), + ...mapState("application", ["expandToolbar"]) }, mounted() { window.addEventListener("keydown", e => { // Escape if (e.keyCode === 27) { - this.lineTool.setActive(false); - this.polygonTool.setActive(false); - this.cutTool.setActive(false); + 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.$store.commit("map/identifyToolEnabled", true); - this.openLayersMap - .getLayer("DRAWTOOL") - .getSource() - .clear(); + this.openLayersMaps.forEach(m => { + m.getLayer("DRAWTOOL") + .getSource() + .clear(); + }); } }); }