From 84c15417f2247fc650a9f7b2c959479519bd3ebb Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 1 Nov 2023 23:54:49 -0400
Subject: fixes to snapping lines when dragging/resizing (lines are created for
 doc not being dragged, snapping lines are created for documents in groups). 
 cleanup of pres path code.

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

(limited to 'src/client/views/DocumentDecorations.tsx')

diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index 65f7c7a70..5a145e94a 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -63,7 +63,6 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
     @observable public pullColor: string = 'white';
     @observable private _isRotating: boolean = false;
     @observable private _isRounding: boolean = false;
-    @observable private _isResizing: boolean = false;
     @observable private showLayoutAcl: boolean = false;
 
     constructor(props: any) {
@@ -475,7 +474,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
 
     @action
     onPointerDown = (e: React.PointerEvent): void => {
-        this._isResizing = true;
+        SnappingManager.SetIsResizing(SelectionManager.Docs().lastElement());
         setupMoveUpEvents(this, e, this.onPointerMove, this.onPointerUp, emptyFunction);
         DocumentView.Interacting = true; // turns off pointer events on things like youtube videos and web pages so that dragging doesn't get "stuck" when cursor moves over them
         this._resizeHdlId = e.currentTarget.className;
@@ -491,7 +490,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
             ffview && ffviewSet.add(ffview);
             this._dragHeights.set(docView.layoutDoc, { start: NumCast(docView.rootDoc._height), lowest: NumCast(docView.rootDoc._height) });
         });
-        Array.from(ffviewSet).map(ffview => ffview.setupDragLines(false));
+        Array.from(ffviewSet).map(ffview => ffview.dragStarting(false, false));
     };
 
     onPointerMove = (e: PointerEvent, down: number[], move: number[]): boolean => {
@@ -686,7 +685,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
 
     @action
     onPointerUp = (e: PointerEvent): void => {
-        this._isResizing = false;
+        SnappingManager.SetIsResizing(undefined);
         this._resizeHdlId = '';
         DocumentView.Interacting = false;
         this._resizeUndo?.end();
@@ -774,7 +773,7 @@ export class DocumentDecorations extends React.Component<{ PanelWidth: number; P
         var shareSymbolIcon = ReverseHierarchyMap.get(shareMode)?.image;
 
         // hide the decorations if the parent chooses to hide it or if the document itself hides it
-        const hideDecorations = this._isResizing || seldocview.props.hideDecorations || seldocview.rootDoc.layout_hideDecorations;
+        const hideDecorations = SnappingManager.GetIsResizing() || seldocview.props.hideDecorations || seldocview.rootDoc.layout_hideDecorations;
         const hideResizers =
             ![AclAdmin, AclEdit, AclAugment].includes(GetEffectiveAcl(seldocview.rootDoc)) || hideDecorations || seldocview.props.hideResizeHandles || seldocview.rootDoc.layout_hideResizeHandles || this._isRounding || this._isRotating;
         const hideTitle = this._showNothing || hideDecorations || seldocview.props.hideDecorationTitle || seldocview.rootDoc.layout_hideDecorationTitle || this._isRounding || this._isRotating;
-- 
cgit v1.2.3-70-g09d2

