diff client/src/components/map/Map.vue @ 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 40a4a808b9b6
children 333aff79197d
line wrap: on
line diff
--- a/client/src/components/map/Map.vue	Tue Apr 16 12:39:55 2019 +0200
+++ b/client/src/components/map/Map.vue	Tue Apr 16 12:49:29 2019 +0200
@@ -72,11 +72,21 @@
       return layers();
     },
     hasActiveInteractions() {
-      return (
-        (this.lineTool && this.lineTool.getActive()) ||
-        (this.polygonTool && this.polygonTool.getActive()) ||
-        (this.cutTool && this.cutTool.getActive())
-      );
+      let active = false;
+      if (this.map) {
+        this.map
+          .getInteractions()
+          .getArray()
+          .filter(i =>
+            ["linetool", "polygontool", "cuttool"].includes(i.get("id"))
+          )
+          .forEach(i => {
+            if (i.getActive()) {
+              active = true;
+            }
+          });
+      }
+      return active;
     }
   },
   methods: {