changeset 2355:31a1dcdba068

client: fix draw line/polygon and use name constants * the drawn line/polygon will disapear from the map when the user click on the relative icon. its a defect in the orginal code * use name constants instead of strings for the call of Layers
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 20 Feb 2019 13:23:30 +0100
parents eebe0a8ddc82
children d66f60163c2f
files client/src/components/toolbar/Linetool.vue client/src/components/toolbar/Polygontool.vue client/src/components/toolbar/Toolbar.vue
diffstat 3 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/toolbar/Linetool.vue	Wed Feb 20 12:23:31 2019 +0100
+++ b/client/src/components/toolbar/Linetool.vue	Wed Feb 20 13:23:30 2019 +0100
@@ -22,11 +22,12 @@
  * Markus Kottländer <markus.kottlaender@intevation.de>
  */
 import { mapState, mapGetters } from "vuex";
+import { LAYERS } from "@/store/map.js";
 
 export default {
   name: "linetool",
   computed: {
-    ...mapGetters("map", ["getLayerByName"]),
+    ...mapGetters("map", ["getVSourceByName"]),
     ...mapState("map", ["lineTool", "polygonTool", "cutTool"])
   },
   methods: {
@@ -35,7 +36,7 @@
       this.polygonTool.setActive(false);
       this.cutTool.setActive(false);
       this.$store.commit("map/setCurrentMeasurement", null);
-      this.getVSourceByName("Draw Tool").clear();
+      this.getVSourceByName(LAYERS.DRAWTOOL).clear();
     }
   }
 };
--- a/client/src/components/toolbar/Polygontool.vue	Wed Feb 20 12:23:31 2019 +0100
+++ b/client/src/components/toolbar/Polygontool.vue	Wed Feb 20 13:23:30 2019 +0100
@@ -22,11 +22,12 @@
  * Markus Kottländer <markus.kottlaender@intevation.de>
  */
 import { mapState, mapGetters } from "vuex";
+import { LAYERS } from "@/store/map.js";
 
 export default {
   name: "polygontool",
   computed: {
-    ...mapGetters("map", ["getLayerByName"]),
+    ...mapGetters("map", ["getVSourceByName"]),
     ...mapState("map", ["lineTool", "polygonTool", "cutTool"])
   },
   methods: {
@@ -35,7 +36,7 @@
       this.lineTool.setActive(false);
       this.cutTool.setActive(false);
       this.$store.commit("map/setCurrentMeasurement", null);
-      this.getVSourceByName("Draw Tool").clear();
+      this.getVSourceByName(LAYERS.DRAWTOOL).clear();
     }
   }
 };
--- a/client/src/components/toolbar/Toolbar.vue	Wed Feb 20 12:23:31 2019 +0100
+++ b/client/src/components/toolbar/Toolbar.vue	Wed Feb 20 13:23:30 2019 +0100
@@ -110,6 +110,7 @@
  * Markus Kottländer <markus.kottlaender@intevation.de>
  */
 import { mapState, mapGetters } from "vuex";
+import { LAYERS } from "@/store/map.js";
 
 export default {
   name: "toolbar",
@@ -135,7 +136,7 @@
         this.cutTool.setActive(false);
         this.$store.commit("map/setCurrentMeasurement", null);
         this.$store.dispatch("map/enableIdentifyTool");
-        this.getVSourceByName("Draw Tool").clear();
+        this.getVSourceByName(LAYERS.DRAWTOOL).clear();
       }
     });
   }