diff client/src/store/fairway.js @ 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 1ef2f4179d30
children a54216a0193d
line wrap: on
line diff
--- a/client/src/store/fairway.js	Tue Apr 16 12:39:55 2019 +0200
+++ b/client/src/store/fairway.js	Tue Apr 16 12:49:29 2019 +0200
@@ -132,15 +132,16 @@
     }
   },
   actions: {
-    clearSelection({ commit, dispatch, rootState, rootGetters }) {
+    clearSelection({ commit, dispatch, rootState }) {
       dispatch("bottlenecks/setSelectedBottleneck", null, { root: true });
       commit("map/identifyToolEnabled", true, { root: true });
       commit("clearCurrentProfile");
-      rootState.map.cutTool.setActive(false);
-      rootGetters["map/openLayersMap"]
-        .getLayer("CUTTOOL")
-        .getSource()
-        .clear();
+      commit("map/cutToolEnabled", false, { root: true });
+      rootState.map.openLayersMaps.forEach(m => {
+        m.getLayer("CUTTOOL")
+          .getSource()
+          .clear();
+      });
     },
     loadProfile({ commit, state }, survey) {
       if (state.startPoint && state.endPoint) {
@@ -218,7 +219,7 @@
           commit("profileLoading", true);
           Promise.all(profileLoaders)
             .then(() => {
-              rootState.map.cutTool.setActive(false);
+              commit("map/cutToolEnabled", false, { root: true });
               const los3 = rootGetters["map/openLayersMap"].getLayer(
                 "FAIRWAYDIMENSIONSLOS3"
               );