From 44b1b4f68a1385980b4f5fa6fbd6ffe6fb018fda Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Wed, 24 Apr 2024 05:56:13 -0400
Subject: what broke

---
 .../collections/collectionSchema/CollectionSchemaView.tsx      | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

(limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')

diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
index 1e8dbc937..e826a7f99 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -93,6 +93,7 @@ export class CollectionSchemaView extends CollectionSubView() {
     @observable _mouseCoordinates = { x: 0, y: 0 };
     @observable _lowestSelectedIndex = -1; //lowest index among selected rows; used to properly sync dragged docs with cursor position
     @observable _relCursorIndex = -1; //cursor index relative to the current selected cells
+    @observable _draggedColIndex = 0;
 
     // target HTMLelement portal for showing a popup menu to edit cell values.
     public get MenuTarget() {
@@ -381,6 +382,7 @@ export class CollectionSchemaView extends CollectionSubView() {
 
     @action
     dragColumn = (e: PointerEvent, index: number) => {
+        this._draggedColIndex = index;
         const dragData = new DragManager.ColumnDragData(index);
         const dragEles = [this._colEles[index]];
         this.childDocs.forEach(doc => dragEles.push(this._rowEles.get(doc).children[1].children[index]));
@@ -406,7 +408,6 @@ export class CollectionSchemaView extends CollectionSubView() {
             }
             return total + curr;
         }, CollectionSchemaView._rowMenuWidth);
-        console.log(index);
         return index;
     };
 
@@ -418,8 +419,8 @@ export class CollectionSchemaView extends CollectionSubView() {
      */
     @action
     setRelCursorIndex = (mouseY: number) => {
-        this._mouseCoordinates.y = mouseY;
-        
+        this._mouseCoordinates.y = mouseY; //updates this.rowDropIndex computed value to overwrite the old cached value
+
         let rowHeight = CollectionSchemaView._rowHeight;
         let adjInitMouseY = mouseY - rowHeight - 100; //rowHeight: height of the column menu cells | 100: height of the top menu
         let yOffset = this._lowestSelectedIndex * rowHeight;
@@ -959,6 +960,9 @@ export class CollectionSchemaView extends CollectionSubView() {
         if (DragManager.docsBeingDragged.length){
             this._mouseCoordinates = { x: e.clientX, y: e.clientY };
         }
+        // let newIndex = this.findColDropIndex(e.clientX);
+        // if (newIndex != this._draggedColIndex) this.moveColumn(this._draggedColIndex, newIndex ?? this._draggedColIndex);
+        // this._draggedColIndex = newIndex ? newIndex : this._draggedColIndex;
     }
 
     @computed get sortedDocs() {
-- 
cgit v1.2.3-70-g09d2

