aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionTreeView.tsx
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2024-04-16 17:44:30 -0400
committersrichman333 <sarah_n_richman@brown.edu>2024-04-16 17:44:30 -0400
commiteb55f45eb18e07a006225713deedaf0083a74bf2 (patch)
treec15135ba2e2b9a7add6938c3567b2acb38cc4f14 /src/client/views/collections/CollectionTreeView.tsx
parent17cca384290a98b28c4f4a4d6bc4cf5edaef4573 (diff)
parent8925cc306bd7ee9a044a3fb2bc19dbb09c495515 (diff)
Merge branch 'master' into sarah-ai-visualization
Diffstat (limited to 'src/client/views/collections/CollectionTreeView.tsx')
-rw-r--r--src/client/views/collections/CollectionTreeView.tsx14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/client/views/collections/CollectionTreeView.tsx b/src/client/views/collections/CollectionTreeView.tsx
index 293c79119..5741fc29b 100644
--- a/src/client/views/collections/CollectionTreeView.tsx
+++ b/src/client/views/collections/CollectionTreeView.tsx
@@ -157,14 +157,12 @@ export class CollectionTreeView extends CollectionSubView<Partial<collectionTree
const dragData = de.complete.docDragData;
if (dragData) {
const sourceDragAction = dragData.dropAction;
- const sameTree = () => Doc.AreProtosEqual(dragData.treeViewDoc, this.Document);
- const isAlreadyInTree = () => sameTree || dragData.draggedDocuments.some(d => d.embedContainer === this.Document && this.childDocs.includes(d));
- dragData.dropAction =
- targetDropAction && !isAlreadyInTree() // if dropped document is not in the tree
- ? targetDropAction // then use the target's drop action if it's specified
- : !sameTree() || sourceDragAction === dropActionType.inPlace // if doc from another tree, or a non inPlace source drag action is specified
- ? sourceDragAction // use the source dragAction
- : dropActionType.same; // otherwise use same tree semantics to move within tree
+ const sameTree = dragData.treeViewDoc?.[DocData] === this.dataDoc;
+ dragData.dropAction = !sameTree // if doc from another tree
+ ? sourceDragAction || targetDropAction // then use the source's dragAction otherwise the target's
+ : sourceDragAction === dropActionType.inPlace // if source drag is inPlace
+ ? sourceDragAction // keep the doc in place
+ : dropActionType.same; // otherwise use same tree semantics to move within tree
e.stopPropagation();
}
};