From cfa0806f3bc45e83a2107156b4417feadfda52dd Mon Sep 17 00:00:00 2001
From: Julian Leucker <leuckerj@gmail.com>
Date: Wed, 26 Jul 2023 17:00:29 +0200
Subject: [PATCH] Change zIndex of dragged item to be the biggest

---
 src/DragContainer.vue | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/DragContainer.vue b/src/DragContainer.vue
index 6c2b644..25eaaeb 100644
--- a/src/DragContainer.vue
+++ b/src/DragContainer.vue
@@ -31,10 +31,13 @@ export default {
         mouseX: event.clientX - rect.x - rect.width / (2 * this.w), // relative to center of the top left square
         mouseY: event.clientY - rect.y - rect.height / (2 * this.h),
       };
+      // Now the element is on top of everything else inside the grid (not on top of other grids though)
+      this.zIndex = 999999;
     },
     handleDragEnd() {
       this.offsetX = 0;
       this.offsetY = 0;
+      this.zIndex = "auto";
     },
     handleDragMove(event) {
       this.offsetX += event.dx;
@@ -108,6 +111,7 @@ export default {
       dataTransfer: {},
       offsetX: 0,
       offsetY: 0,
+      zIndex: "auto",
     };
   },
 };
@@ -123,5 +127,6 @@ export default {
     calc(1px * v-bind(offsetX)),
     calc(1px * v-bind(offsetY))
   );
+  z-index: v-bind(zIndex);
 }
 </style>
-- 
GitLab