changeset 836:0b994949a4a0

client: make Morphtool selection more robust * Check if the selected features we are testing has an id before operating on it.
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 28 Sep 2018 10:17:11 +0200
parents 232f3f345cf0
children 1761694dad4a
files client/src/application/Morphtool.vue client/src/map/store.js
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Morphtool.vue	Fri Sep 28 10:13:54 2018 +0200
+++ b/client/src/application/Morphtool.vue	Fri Sep 28 10:17:11 2018 +0200
@@ -65,7 +65,8 @@
     selectedBottleneck: function() {
       if (this.identifiedFeatures) {
         for (let feature of this.identifiedFeatures) {
-          if (feature.getId().replace(/[.][^.]*$/, "") === "bottlenecks") {
+          let id = feature.getId();
+          if (id && id.replace(/[.][^.]*$/, "") === "bottlenecks") {
             return feature;
           }
         }
@@ -85,6 +86,7 @@
   },
   methods: {
     queryBottleneck(name) {
+      // DEBUG console.log("starting to query bottleneck", name);
       HTTP.get("/surveys/" + name, {
         headers: {
           "X-Gemma-Auth": localStorage.getItem("token"),
--- a/client/src/map/store.js	Fri Sep 28 10:13:54 2018 +0200
+++ b/client/src/map/store.js	Fri Sep 28 10:17:11 2018 +0200
@@ -169,6 +169,8 @@
         isVisible: true
       }
     ],
+    // note that some identified features may not have an id
+    // especially related to drawing in our own vector layer
     identifiedFeatures: [],
     currentMeasurement: null,
     selectedMorph: null