From 0e3892e63758accd7dae274072ad7893934c3624 Mon Sep 17 00:00:00 2001 From: bobzel 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<{}> { FontIconBox.SetShowLabels(!FontIconBox.GetShowLabels())} checked={FontIconBox.GetShowLabels()} />
Show button labels
+
+ FontIconBox.SetRecognizeGesturs(!FontIconBox.GetRecognizeGestures())} checked={FontIconBox.GetRecognizeGestures()} /> +
Recognize ink Gesturs
+
); } -- cgit v1.2.3-70-g09d2 From 68ab5eb3dfa981d16ccb632a8dff015866ca13e2 Mon Sep 17 00:00:00 2001 From: geireann 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 (
@@ -323,6 +334,13 @@ export class SettingsManager extends React.Component<{}> {
Playground Mode
+
Freeform scroll mode
+
+ +
Scrolling pans around the freeform, holding shift and scrolling zooms in and out.
+ +
Scrolling zooms in and out of canvas
+
Permissions
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 { + 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 { 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