From 3cc27a771374956da7af3df347b39bd07794fc5f Mon Sep 17 00:00:00 2001
From: Adam Procter <adamprocter@researchnot.es>
Date: Fri, 11 Dec 2020 14:11:28 +0000
Subject: [PATCH] forgot OtherNodes

z-index updated
---
 .DS_Store                              | Bin 10244 -> 10244 bytes
 app/src/components/OtherNodeslayer.vue |  34 ++++++++++++++++++-------
 2 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/.DS_Store b/.DS_Store
index 25365651516be58a6fc23d97d43d9c8cf0391fbb..730468d8f36d609db8a6a635e5dab39b6e0cf1e2 100644
GIT binary patch
delta 21
ccmZn(XbISGT7bjY(ojdi(86%@WdTER08ljsod5s;

delta 21
ccmZn(XbISGT7bjS!bnHK(9CG_WdTER08n}cq5uE@

diff --git a/app/src/components/OtherNodeslayer.vue b/app/src/components/OtherNodeslayer.vue
index 91e8f8b..7a9c8b1 100644
--- a/app/src/components/OtherNodeslayer.vue
+++ b/app/src/components/OtherNodeslayer.vue
@@ -11,7 +11,7 @@
             :y="value.y_pos"
             :z="value.z_index"
             :scale="scale"
-            @activated="onActivated(nodes.node_id)"
+            @activated="onActivated(nodes.node_id, value.z_index)"
             :draggable="false"
             :resizable="false"
             @dragging="onDrag"
@@ -122,7 +122,7 @@
             :y="value.y_pos"
             :z="value.z_index"
             :scale="scale"
-            @activated="onActivated(nodes.node_id)"
+            @activated="onActivated(nodes.node_id, value.z_index)"
             @dragging="onDrag"
             @resizing="onResize"
             @dragstop="onDragstop"
@@ -312,14 +312,30 @@ export default {
     //   this.$options.positionsArray = this.positions_filtered
     //   this.$forceUpdate()
     // },
-    onActivated(e) {
-      this.nodeid = e
+    onActivated(id, zindex) {
+      this.zindex = zindex
+      this.nodeid = id
       var i
+      var zindexes = []
       for (i = 0; i < Object.keys(this.configPositions).length; i++) {
+        zindexes.push(this.configPositions[i].z_index)
         if (this.configPositions[i].node_id == this.nodeid) {
           this.width = this.configPositions[i].width
           this.height = this.configPositions[i].height
-          this.pickupz = this.configPositions[i].z_index
+          this.zindex = this.configPositions[i].z_index
+        }
+      }
+      var topZ = Math.max(...zindexes)
+
+      for (i = 0; i < Object.keys(this.configPositions).length; i++) {
+        if (topZ > 2147483640) {
+          this.configPositions[i].z_index = 0
+        }
+
+        if (this.configPositions[i].node_id == this.nodeid) {
+          this.width = this.configPositions[i].width
+          this.height = this.configPositions[i].height
+          this.configPositions[i].z_index = topZ + 1
         }
       }
     },
@@ -331,13 +347,13 @@ export default {
     },
     onResizestop(x, y, width, height, zindex) {
       var localnodeid = this.nodeid
-      zindex = this.pickupz
+      var zindex
       var i
       for (i = 0; i < Object.keys(this.configPositions).length; i++) {
         if (this.configPositions[i].node_id == this.nodeid) {
           this.width = this.configPositions[i].width
           this.height = this.configPositions[i].height
-          this.pickupz = this.configPositions[i].z_index
+          zindex = this.configPositions[i].z_index
         }
       }
       this.width = width
@@ -357,7 +373,7 @@ export default {
     },
     onDragstop(x, y, width, height, zindex) {
       var localnodeid = this.nodeid
-      zindex = this.pickupz
+      var zindex
       width = this.width
       height = this.height
       var i
@@ -365,7 +381,7 @@ export default {
         if (this.configPositions[i].node_id == this.nodeid) {
           this.localx = this.configPositions[i].x_pos
           this.localy = this.configPositions[i].y_pos
-          this.pickupz = this.configPositions[i].z_index
+          zindex = this.configPositions[i].z_index
         }
       }
       this.$store.dispatch('movePos', {
-- 
GitLab