From d25beeb937bd6fa82cbf08e8289be6fbf22aec19 Mon Sep 17 00:00:00 2001
From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com>
Date: Tue, 23 Apr 2024 17:36:55 -0400
Subject: jitter on initial drag fixed (computed value caching)

---
 .../collections/collectionSchema/CollectionSchemaView.tsx      | 10 ++++++----
 1 file changed, 6 insertions(+), 4 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 46048a408..1e8dbc937 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx
@@ -418,6 +418,8 @@ export class CollectionSchemaView extends CollectionSubView() {
      */
     @action
     setRelCursorIndex = (mouseY: number) => {
+        this._mouseCoordinates.y = mouseY;
+        
         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;
@@ -449,8 +451,8 @@ export class CollectionSchemaView extends CollectionSubView() {
         //fix index if selected rows are dragged out of bounds
         let adjIndex = index - this._relCursorIndex;
         let maxY = this.rowHeights.reduce((total, curr) => total + curr, 0) + rowHeight;
-        if (mouseY > maxY) index = this.childDocs.length - 1;
-        else if (adjIndex <= 0) return 0
+        if (mouseY > maxY) adjIndex = this.childDocs.length - 1;
+        else if (adjIndex <= 0) adjIndex = 0;
 
         return adjIndex;
     };
@@ -552,8 +554,8 @@ export class CollectionSchemaView extends CollectionSubView() {
 
     @computed
     get rowDropIndex(){
-        const mouseY = this.ScreenToLocalBoxXf().transformPoint(this._mouseCoordinates.x, this._mouseCoordinates.y)[1];
-        const index = this.findRowDropIndex(mouseY);
+        let mouseY = this.ScreenToLocalBoxXf().transformPoint(this._mouseCoordinates.x, this._mouseCoordinates.y)[1];
+        let index = this.findRowDropIndex(mouseY);
         return index
     }
 
-- 
cgit v1.2.3-70-g09d2

