aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index cca78cf9f..fe3d57bdb 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -184,7 +184,7 @@ export class CollectionStackingView extends CollectionSubView(StackingDocument)
if (found) {
const top = found.getBoundingClientRect().top;
const localTop = this.props.ScreenToLocalTransform().transformPoint(0, top);
- smoothScroll(500, this._mainCont!, localTop[1] + this._mainCont!.scrollTop);
+ smoothScroll(doc.presTransition || doc.presTransition === 0 ? NumCast(doc.presTransition) : 500, this._mainCont!, localTop[1] + this._mainCont!.scrollTop);
}
afterFocus && setTimeout(() => {
if (afterFocus?.()) { }
@@ -287,19 +287,31 @@ export class CollectionStackingView extends CollectionSubView(StackingDocument)
}
});
if (super.onInternalDrop(e, de)) {
- const newDoc = de.complete.docDragData.droppedDocuments[0];
+ const newDocs = de.complete.docDragData.droppedDocuments;
const docs = this.childDocList;
if (docs) {
- if (targInd === -1) targInd = docs.length;
- else targInd = docs.indexOf(this.filteredChildren[targInd]);
- const srcInd = docs.indexOf(newDoc);
- docs.splice(srcInd, 1);
- docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, newDoc);
+ newDocs.map((doc, i) => {
+ console.log(doc.title);
+ if (i === 0) {
+ if (targInd === -1) targInd = docs.length;
+ else targInd = docs.indexOf(this.filteredChildren[targInd]);
+ const srcInd = docs.indexOf(doc);
+ docs.splice(srcInd, 1);
+ docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, doc);
+ } else if (i < (newDocs.length / 2)) { //glr: for some reason dragged documents are duplicated
+ if (targInd === -1) targInd = docs.length;
+ else targInd = docs.indexOf(newDocs[0]) + 1;
+ const srcInd = docs.indexOf(doc);
+ docs.splice(srcInd, 1);
+ docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, doc);
+ }
+ });
}
}
}
return false;
}
+
@undoBatch
@action
onExternalDrop = async (e: React.DragEvent): Promise<void> => {