comparison 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
comparison
equal deleted inserted replaced
3061:563176194d74 3062:87e0422cffa7
114 * Software engineering by Intevation GmbH 114 * Software engineering by Intevation GmbH
115 * 115 *
116 * Author(s): 116 * Author(s):
117 * Markus Kottländer <markus.kottlaender@intevation.de> 117 * Markus Kottländer <markus.kottlaender@intevation.de>
118 */ 118 */
119 import { mapState, mapGetters } from "vuex"; 119 import { mapState } from "vuex";
120 120
121 export default { 121 export default {
122 name: "toolbar", 122 name: "toolbar",
123 components: { 123 components: {
124 PaneControl: () => import("./PaneControl"), 124 PaneControl: () => import("./PaneControl"),
129 Profiles: () => import("./Profiles"), 129 Profiles: () => import("./Profiles"),
130 Gauges: () => import("./Gauges"), 130 Gauges: () => import("./Gauges"),
131 Pdftool: () => import("./Pdftool") 131 Pdftool: () => import("./Pdftool")
132 }, 132 },
133 computed: { 133 computed: {
134 ...mapState("map", ["lineTool", "polygonTool", "cutTool"]), 134 ...mapState("map", ["openLayersMaps"]),
135 ...mapState("application", ["expandToolbar", "panes"]), 135 ...mapState("application", ["expandToolbar"])
136 ...mapGetters("map", ["openLayersMap"])
137 }, 136 },
138 mounted() { 137 mounted() {
139 window.addEventListener("keydown", e => { 138 window.addEventListener("keydown", e => {
140 // Escape 139 // Escape
141 if (e.keyCode === 27) { 140 if (e.keyCode === 27) {
142 this.lineTool.setActive(false); 141 this.$store.commit("map/lineToolEnabled", false);
143 this.polygonTool.setActive(false); 142 this.$store.commit("map/polygonToolEnabled", false);
144 this.cutTool.setActive(false); 143 this.$store.commit("map/cutToolEnabled", false);
145 this.$store.commit("map/setCurrentMeasurement", null); 144 this.$store.commit("map/setCurrentMeasurement", null);
146 this.$store.commit("map/identifyToolEnabled", true); 145 this.$store.commit("map/identifyToolEnabled", true);
147 this.openLayersMap 146 this.openLayersMaps.forEach(m => {
148 .getLayer("DRAWTOOL") 147 m.getLayer("DRAWTOOL")
149 .getSource() 148 .getSource()
150 .clear(); 149 .clear();
150 });
151 } 151 }
152 }); 152 });
153 } 153 }
154 }; 154 };
155 </script> 155 </script>