From a6577f0c085d206db11e491bd4a1e4bae70e0ee6 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 12 Apr 2024 13:51:07 -0400
Subject:  fixed auto play for trails.  fixed presbox to allow drag and drop in
 addition to pin button.  fixed tree view to not 'move' items that have a
 'copy' drop action.  fixed dragPreDrop functions in tree and stacking views
 to use source drag action over target drop action.

---
 src/client/views/collections/CollectionTreeView.tsx | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

(limited to 'src/client/views/collections/CollectionTreeView.tsx')

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();
         }
     };
-- 
cgit v1.2.3-70-g09d2

