From f1ee3a6baffb22093d81e123d70f6ec9631c2075 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 15 Oct 2020 15:20:51 -0400
Subject: got rid of isDragging in favor of a field on the PresElement.  fixed
 moving items in presBox by fixing websocket to maintain ordering on
 sequential operations on a list.  fixed list splicing to not call addToSet
 unless splicing is at end of list.  fixed setting return scale when following
 link into portal

---
 .../views/collections/CollectionStackingView.tsx   | 23 ++++++----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

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

diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 3607b97d0..fc4ca3100 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -292,25 +292,14 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
             if (super.onInternalDrop(e, de)) {
                 const newDocs = de.complete.docDragData.droppedDocuments;
                 const docs = this.childDocList;
+                DragManager.docsBeingDragged = [];
                 if (docs) {
                     newDocs.map((doc, i) => {
-                        if (i === 0) {
-                            if (doc.presentationTargetDoc) doc.dragging = false; //glr: so it only applies to items in presentation
-                            DragManager.docsBeingDragged = [];
-                            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 (doc.presentationTargetDoc) doc.dragging = false;
-                            DragManager.docsBeingDragged = [];
-                            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);
-                        }
+                        targInd = targInd === -1 ? docs.length : targInd;
+                        const srcInd = docs.indexOf(doc);
+                        if (targInd !== -1) targInd = i === 0 ? docs.indexOf(this.filteredChildren[targInd]) : docs.indexOf(newDocs[0]) + 1;
+                        docs.splice(srcInd, 1);
+                        docs.splice((targInd > srcInd ? targInd - 1 : targInd) + plusOne, 0, doc);
                     });
                 }
             }
-- 
cgit v1.2.3-70-g09d2

