From 9352541dcc467794c792f0c526f5c45bfd8174a8 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 5 Aug 2022 09:57:58 -0400
Subject: fixed dragging over bottom of notetaking columns.

---
 src/client/views/collections/CollectionNoteTakingView.tsx | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

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

diff --git a/src/client/views/collections/CollectionNoteTakingView.tsx b/src/client/views/collections/CollectionNoteTakingView.tsx
index 1bf5b7d86..e0c79a265 100644
--- a/src/client/views/collections/CollectionNoteTakingView.tsx
+++ b/src/client/views/collections/CollectionNoteTakingView.tsx
@@ -369,8 +369,8 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
 
     // This function is used to preview where a document will drop in a column once a drag is complete.
     @action
-    onPointerOver = (buttons: boolean, ex: number, ey: number) => {
-        if (this.childDocList && buttons) {
+    onPointerMove = (force: boolean, ex: number, ey: number) => {
+        if (this.childDocList && (this.childDocList.includes(DragManager.DocDragData?.draggedDocuments.lastElement()!) || force || (SnappingManager.GetIsDragging() && DragManager.CanEmbed))) {
             // get the current docs for the column based on the mouse's x coordinate
             // will use again later, which is why we're saving as local
             const xCoord = this.props.ScreenToLocalTransform().transformPoint(ex, ey)[0] - 2 * this.gridGap;
@@ -501,7 +501,7 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
     onExternalDrop = async (e: React.DragEvent): Promise<void> => {
         const targInd = this.docsDraggedRowCol?.[0] || 0;
         super.onExternalDrop(e, {}, docus => {
-            this.onPointerOver(true, e.clientX, e.clientY);
+            this.onPointerMove(true, e.clientX, e.clientY);
             docus?.map(doc => this.addDocument(doc));
             const newDoc = this.childDocs.lastElement();
             const docs = this.childDocList;
@@ -707,7 +707,8 @@ export class CollectionNoteTakingView extends CollectionSubView<Partial<collecti
                     }}
                     onScroll={action(e => (this._scroll = e.currentTarget.scrollTop))}
                     onPointerLeave={action(e => (this.docsDraggedRowCol.length = 0))}
-                    onPointerOver={e => this.onPointerOver(e.buttons ? true : false, e.clientX, e.clientY)}
+                    onPointerMove={e => e.buttons && this.onPointerMove(false, e.clientX, e.clientY)}
+                    onDragOver={e => this.onPointerMove(true, e.clientX, e.clientY)}
                     onDrop={this.onExternalDrop.bind(this)}
                     onContextMenu={this.onContextMenu}
                     onWheel={e => this.props.isContentActive(true) && e.stopPropagation()}>
-- 
cgit v1.2.3-70-g09d2

