diff options
author | bobzel <zzzman@gmail.com> | 2022-08-05 15:17:28 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-08-05 15:17:28 -0400 |
commit | 9f48faf496525aa6e435ee3dea7b1114962db9ce (patch) | |
tree | 8bce085a9c25ea3e06fe9daff66975486395924f /src/client/util/DragManager.ts | |
parent | 57f51df7037ff925ebcd30d1060daa2639dfe35f (diff) |
fixed undoing aborted notetaking view drags.
Diffstat (limited to 'src/client/util/DragManager.ts')
-rw-r--r-- | src/client/util/DragManager.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts index f4987cf34..947882958 100644 --- a/src/client/util/DragManager.ts +++ b/src/client/util/DragManager.ts @@ -448,16 +448,16 @@ export namespace DragManager { AbortDrag = () => { options?.dragComplete?.(new DragCompleteEvent(true, dragData)); - cleanupDrag(); + cleanupDrag(true); }; - const cleanupDrag = action(() => { + const cleanupDrag = action((undo: boolean) => { hideDragShowOriginalElements(false); document.removeEventListener('pointermove', moveHandler, true); document.removeEventListener('pointerup', upHandler, true); SnappingManager.SetIsDragging(false); SnappingManager.clearSnapLines(); - batch.end(); + if (undo && batch.end()) UndoManager.Undo(); docsBeingDragged.length = 0; }); var startWindowDragTimer: any; @@ -548,7 +548,7 @@ export namespace DragManager { const upHandler = (e: PointerEvent) => { clearTimeout(startWindowDragTimer); startWindowDragTimer = undefined; - dispatchDrag(document.elementFromPoint(e.x, e.y) || document.body, e, new DragCompleteEvent(false, dragData), snapDrag(e, xFromLeft, yFromTop, xFromRight, yFromBottom), finishDrag, options, cleanupDrag); + dispatchDrag(document.elementFromPoint(e.x, e.y) || document.body, e, new DragCompleteEvent(false, dragData), snapDrag(e, xFromLeft, yFromTop, xFromRight, yFromBottom), finishDrag, options, () => cleanupDrag(false)); }; document.addEventListener('pointermove', moveHandler, true); document.addEventListener('pointerup', upHandler, true); |