diff options
-rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 10 |
1 files changed, 6 insertions, 4 deletions
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 |