aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-04-23 16:49:16 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-04-23 16:49:16 -0400
commita114de8e42c20edc7dabce6e2ac94559279d9aa0 (patch)
tree92806e9ee67058d2e83e3600bf49c43a5d055cf9 /src
parent18ac9cad95588cea1f2b999aabee3e2eb03b51f0 (diff)
out of bounds dragging fixed
Diffstat (limited to 'src')
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaView.tsx10
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