diff client/src/store/fairway.js @ 1237:74562dc29e10

refactored drawtool The map interactions (ol/interaction/Draw) were previously always removed and re-created. Now there are created and added to the map once and their active flag is used to toggle the tools. Results in cleaner code and easier separation of the buttons in the future.
author Markus Kottlaender <markus@intevation.de>
date Tue, 20 Nov 2018 13:03:24 +0100
parents 48ae4458710d
children bc55ffaeb639
line wrap: on
line diff
--- a/client/src/store/fairway.js	Tue Nov 20 12:47:16 2018 +0100
+++ b/client/src/store/fairway.js	Tue Nov 20 13:03:24 2018 +0100
@@ -105,11 +105,10 @@
       dispatch("bottlenecks/setSelectedBottleneck", null, { root: true });
       commit("clearCurrentProfile");
       commit("application/showSplitscreen", false, { root: true });
-      commit("map/cutMode", false, { root: true });
+      rootState.map.cutTool.setActive(false);
       rootGetters["map/getLayerByName"]("Cut Tool")
         .data.getSource()
         .clear();
-      rootState.map.openLayersMap.removeInteraction(rootState.map.cutTool);
     },
     loadProfile({ commit, state }, survey) {
       return new Promise((resolve, reject) => {
@@ -188,7 +187,6 @@
             commit("application/showSplitscreen", true, { root: true });
           })
           .catch(error => {
-            console.log(error);
             const { status, data } = error.response;
             displayError({
               title: "Backend Error",