From 58213b0201ea0191f06f42beac9c3a17ebfc98ea Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 1 Nov 2023 15:38:22 -0400
Subject: fixed so that ink properties can be set before drawing a stroke.
 fixed turning off ink when menu is collapsed.  added meta-click to fit all
 for collections, or zoom in on a document.

---
 .../collectionFreeForm/CollectionFreeFormView.tsx         | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

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

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 1e341f60d..a8b743896 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -312,6 +312,12 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
 
     focus = (anchor: Doc, options: DocFocusOptions) => {
         if (this._lightboxDoc) return;
+        if (anchor === this.rootDoc) {
+            if (options.willZoomCentered && options.zoomScale) {
+                this.fitContentOnce();
+                options.didMove = true;
+            }
+        }
         if (anchor.type !== DocumentType.CONFIG && !DocListCast(this.Document[this.fieldKey ?? Doc.LayoutFieldKey(this.Document)]).includes(anchor)) return;
         const xfToCollection = options?.docTransform ?? Transform.Identity();
         const savedState = { panX: NumCast(this.Document[this.panXFieldKey]), panY: NumCast(this.Document[this.panYFieldKey]), scale: options?.willZoomCentered ? this.Document[this.scaleFieldKey] : undefined };
@@ -1620,15 +1626,6 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
                     () => this.isContentActive(), // if autoreset is on, then whenever the view is selected, it will be restored to it default pan/zoom positions
                     active => !SnappingManager.GetIsDragging() && this.rootDoc[this.autoResetFieldKey] && active && this.resetView()
                 );
-
-                this._disposers.fitContent = reaction(
-                    () => this.rootDoc.fitContentOnce,
-                    fitContentOnce => {
-                        if (fitContentOnce) this.fitContentOnce();
-                        this.rootDoc.fitContentOnce = undefined;
-                    },
-                    { fireImmediately: true, name: 'fitContent' }
-                );
             })
         );
     }
-- 
cgit v1.2.3-70-g09d2

