diff options
| author | geireann <geireann.lindfield@gmail.com> | 2023-11-09 13:21:59 -0500 |
|---|---|---|
| committer | geireann <geireann.lindfield@gmail.com> | 2023-11-09 13:21:59 -0500 |
| commit | 634e2e3264a7199fc420909da8b5ab1b98d64705 (patch) | |
| tree | 47358ab6fe05b644e0146e12962bde370f981d51 /src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | |
| parent | 224a9162859d98a36c13eb72c4b88f38eb52e28d (diff) | |
playing with pan zoom modes.
Diffstat (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx')
| -rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index ee3dcca11..bb6740260 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -837,11 +837,13 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection }; @action - pan = (e: PointerEvent | React.Touch | { clientX: number; clientY: number }): void => { + pan = (e: PointerEvent | { clientX: number; clientY: number }): void => { + const ctrlKey = (e as any).ctrlKey; + const shiftKey = (e as any).shiftKey; PresBox.Instance?.pauseAutoPres(); this.props.DocumentView?.().clearViewTransition(); const [dx, dy] = this.getTransform().transformDirection(e.clientX - this._lastX, e.clientY - this._lastY); - this.setPan(NumCast(this.Document[this.panXFieldKey]) - dx, NumCast(this.Document[this.panYFieldKey]) - dy, 0, true); + this.setPan(NumCast(this.Document[this.panXFieldKey]) - (ctrlKey ? 0: dx), NumCast(this.Document[this.panYFieldKey]) - (shiftKey ? 0: dy), 0, true); this._lastX = e.clientX; this._lastY = e.clientY; }; @@ -1080,11 +1082,13 @@ export class CollectionFreeFormView extends CollectionSubView<Partial<collection e.stopPropagation(); const docHeight = NumCast(this.rootDoc[Doc.LayoutFieldKey(this.rootDoc) + '_nativeHeight'], this.nativeHeight); const scrollable = NumCast(this.layoutDoc[this.scaleFieldKey], 1) === 1 && docHeight > this.props.PanelHeight() / this.nativeDimScaling + 1e-4; - switch (!e.ctrlKey ? Doc.UserDoc().freeformScrollMode : freeformScrollMode.Pan) { + switch (!e.ctrlKey && !e.shiftKey? Doc.UserDoc().freeformScrollMode : freeformScrollMode.Pan) { case freeformScrollMode.Pan: // if ctrl is selected then zoom - if (!e.ctrlKey && this.props.isContentActive(true)) { - this.scrollPan({ deltaX: -e.deltaX * this.getTransform().Scale, deltaY: e.shiftKey ? 0 : -e.deltaY * this.getTransform().Scale }); + if ((!e.ctrlKey || Doc.UserDoc().freeformScrollMode === freeformScrollMode.Zoom) && this.props.isContentActive(true)) { + const deltaX = e.shiftKey ? e.deltaY: e.deltaX; + const deltaY = e.shiftKey ? e.deltaX : e.deltaY; + this.scrollPan({ deltaX: -deltaX * this.getTransform().Scale, deltaY: e.shiftKey ? 0 : -deltaY * this.getTransform().Scale }); break; } default: |
