From 0e3892e63758accd7dae274072ad7893934c3624 Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Tue, 18 Oct 2022 15:07:31 -0400
Subject: cleaned up gestureutils a bit.  added recognize gestures option, but
 it probably shouldn't be used until the geometry gesture recognition
 descriptions are improved.

---
 src/client/util/SettingsManager.tsx | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/client/util/SettingsManager.tsx')

diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index a185c8936..92032a8f9 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -186,6 +186,10 @@ export class SettingsManager extends React.Component<{}> {
                     <input type="checkbox" onChange={e => FontIconBox.SetShowLabels(!FontIconBox.GetShowLabels())} checked={FontIconBox.GetShowLabels()} />
                     <div className="preferences-check">Show button labels</div>
                 </div>
+                <div>
+                    <input type="checkbox" onChange={e => FontIconBox.SetRecognizeGesturs(!FontIconBox.GetRecognizeGestures())} checked={FontIconBox.GetRecognizeGestures()} />
+                    <div className="preferences-check">Recognize ink Gesturs</div>
+                </div>
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2


From 68ab5eb3dfa981d16ccb632a8dff015866ca13e2 Mon Sep 17 00:00:00 2001
From: geireann <geireann.lindfield@gmail.com>
Date: Mon, 24 Oct 2022 14:55:44 -0400
Subject: added first draft version of scrolling up and scrolling sideways

---
 src/client/util/SettingsManager.tsx                | 18 ++++++++
 .../collectionFreeForm/CollectionFreeFormView.tsx  | 50 ++++++++++++++++++----
 2 files changed, 60 insertions(+), 8 deletions(-)

(limited to 'src/client/util/SettingsManager.tsx')

diff --git a/src/client/util/SettingsManager.tsx b/src/client/util/SettingsManager.tsx
index 92032a8f9..5c1c836f7 100644
--- a/src/client/util/SettingsManager.tsx
+++ b/src/client/util/SettingsManager.tsx
@@ -26,6 +26,11 @@ export enum ColorScheme {
     System = '-MatchSystem',
 }
 
+export enum freeformScrollMode {
+    Pan = 'pan',
+    Zoom = 'zoom'
+}
+
 @observer
 export class SettingsManager extends React.Component<{}> {
     public static Instance: SettingsManager;
@@ -302,6 +307,12 @@ export class SettingsManager extends React.Component<{}> {
         );
     }
 
+
+
+    setFreeformScrollMode = (mode: freeformScrollMode) => {
+        Doc.UserDoc().freeformScrollMode = mode;
+    }
+
     @computed get modesContent() {
         return (
             <div className="tab-content modes-content">
@@ -323,6 +334,13 @@ export class SettingsManager extends React.Component<{}> {
                             <div className="playground-text">Playground Mode</div>
                         </div>
                     </div>
+                    <div className="tab-column-title">Freeform scroll mode</div>
+                    <div>
+                        <button onClick={() => this.setFreeformScrollMode(freeformScrollMode.Pan)}>Scroll to pan</button>
+                        <div>Scrolling pans around the freeform, holding shift and scrolling zooms in and out.</div>
+                        <button onClick={() => this.setFreeformScrollMode(freeformScrollMode.Zoom)}>Scroll to zoom</button>
+                        <div>Scrolling zooms in and out of canvas</div>
+                    </div>
                 </div>
                 <div className="tab-column">
                     <div className="tab-column-title">Permissions</div>
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index 7b93408c3..50ccc77cb 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -26,7 +26,7 @@ import { InteractionUtils } from '../../../util/InteractionUtils';
 import { ReplayMovements } from '../../../util/ReplayMovements';
 import { ScriptingGlobals } from '../../../util/ScriptingGlobals';
 import { SelectionManager } from '../../../util/SelectionManager';
-import { ColorScheme } from '../../../util/SettingsManager';
+import { ColorScheme, freeformScrollMode } from '../../../util/SettingsManager';
 import { SnappingManager } from '../../../util/SnappingManager';
 import { Transform } from '../../../util/Transform';
 import { undoBatch, UndoManager } from '../../../util/UndoManager';
@@ -700,6 +700,14 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
         }
     };
 
+    @action
+    scrollPan = (e: WheelEvent | { deltaX: number; deltaY: number }): void => {
+        const dx = e.deltaX;
+        const dy = e.deltaY;
+        console.log("2: ", dx, dy);
+        this.setPan(NumCast(this.Document._panX) - dx, NumCast(this.Document._panY) - dy, 0, true);
+    };
+
     @action
     pan = (e: PointerEvent | React.Touch | { clientX: number; clientY: number }): void => {
         const [dx, dy] = this.getTransform().transformDirection(e.clientX - this._lastX, e.clientY - this._lastY);
@@ -999,13 +1007,39 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection
     @action
     onPointerWheel = (e: React.WheelEvent): void => {
         if (this.layoutDoc._Transform || DocListCast(Doc.MyOverlayDocs?.data).includes(this.props.Document) || this.props.Document.treeViewOutlineMode === TreeViewType.outline) return;
-        if (!e.ctrlKey && this.props.Document.scrollHeight !== undefined) {
-            // things that can scroll vertically should do that instead of zooming
-            e.stopPropagation();
-        } else if (this.props.isContentActive(true) && !this.Document._isGroup) {
-            e.stopPropagation();
-            e.preventDefault();
-            !this.props.isAnnotationOverlayScrollable && this.zoom(e.clientX, e.clientY, e.deltaY); // if (!this.props.isAnnotationOverlay) // bcz: do we want to zoom in on images/videos/etc?
+        e.stopPropagation();
+        e.preventDefault();
+        switch (Doc.UserDoc().freeformScrollMode) {
+            case freeformScrollMode.Pan:
+                // if shift is selected then zoom
+                if(e.ctrlKey) {
+                    if (!e.ctrlKey && this.props.Document.scrollHeight !== undefined) {
+                        // things that can scroll vertically should do that instead of zooming
+                    } else if (this.props.isContentActive(true) && !this.Document._isGroup) {
+                        !this.props.isAnnotationOverlayScrollable && this.zoom(e.clientX, e.clientY, e.deltaY); // if (!this.props.isAnnotationOverlay) // bcz: do we want to zoom in on images/videos/etc?
+                    }
+                // otherwise pan
+                } else if (!e.ctrlKey && this.props.Document.scrollHeight !== undefined) {
+                    // things that can scroll vertically should do that instead of zooming
+                } else if (this.props.isContentActive(true) && !this.Document._isGroup) {
+                    const dx = e.deltaX;
+                    const dy = e.deltaY;
+                    console.log("1: ", dx, dy);
+                    if (e.shiftKey) {
+                        !this.props.isAnnotationOverlayScrollable && this.scrollPan({ deltaX: dy, deltaY: 0 }); 
+                    } else {
+                        !this.props.isAnnotationOverlayScrollable && this.scrollPan({ deltaX: dx, deltaY: dy }); 
+                    }
+                }
+                break;
+            default:
+            case freeformScrollMode.Zoom:
+                if (!e.ctrlKey && this.props.Document.scrollHeight !== undefined) {
+                    // things that can scroll vertically should do that instead of zooming
+                } else if (this.props.isContentActive(true) && !this.Document._isGroup) {
+                    !this.props.isAnnotationOverlayScrollable && this.zoom(e.clientX, e.clientY, e.deltaY); // if (!this.props.isAnnotationOverlay) // bcz: do we want to zoom in on images/videos/etc?
+                }
+                break;
         }
     };
 
-- 
cgit v1.2.3-70-g09d2

