# HG changeset patch # User Fadi Abbud # Date 1550665410 -3600 # Node ID 31a1dcdba068fe08d0f70db300664b66c4c7c3d4 # Parent eebe0a8ddc82bf41eb44e634abb56855cb805761 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 diff -r eebe0a8ddc82 -r 31a1dcdba068 client/src/components/toolbar/Linetool.vue --- 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 */ 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(); } } }; diff -r eebe0a8ddc82 -r 31a1dcdba068 client/src/components/toolbar/Polygontool.vue --- 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 */ 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(); } } }; diff -r eebe0a8ddc82 -r 31a1dcdba068 client/src/components/toolbar/Toolbar.vue --- 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 */ 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(); } }); }