From a114de8e42c20edc7dabce6e2ac94559279d9aa0 Mon Sep 17 00:00:00 2001 From: Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:49:16 -0400 Subject: out of bounds dragging fixed --- .../collections/collectionSchema/CollectionSchemaView.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 3de70ca2c..46048a408 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -436,6 +436,7 @@ export class CollectionSchemaView extends CollectionSubView() { //Uses current mouse position to calculate the indexes of actively dragged docs findRowDropIndex = (mouseY: number) => { + let rowHeight = CollectionSchemaView._rowHeight; let index: number = 0; this.rowHeights.reduce((total, curr, i) => { if (total <= mouseY && total + curr >= mouseY) { @@ -443,14 +444,15 @@ export class CollectionSchemaView extends CollectionSubView() { else index = i + 1; } return total + curr; - }, CollectionSchemaView._rowHeight); + }, rowHeight); //fix index if selected rows are dragged out of bounds - if (index <= 0) index = 1 - let maxY = this.rowHeights.reduce((total, curr) => total + curr, 0) + CollectionSchemaView._rowHeight; + 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 - return index - this._relCursorIndex; + return adjIndex; }; @action -- cgit v1.2.3-70-g09d2