From 634e2e3264a7199fc420909da8b5ab1b98d64705 Mon Sep 17 00:00:00 2001 From: geireann Date: Thu, 9 Nov 2023 13:21:59 -0500 Subject: playing with pan zoom modes. --- src/client/views/GlobalKeyHandler.ts | 4 ++-- .../collectionFreeForm/CollectionFreeFormView.tsx | 14 +++++++++----- .../views/collections/collectionFreeForm/MarqueeView.tsx | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/views/GlobalKeyHandler.ts b/src/client/views/GlobalKeyHandler.ts index 7b693c8da..ec10d21e0 100644 --- a/src/client/views/GlobalKeyHandler.ts +++ b/src/client/views/GlobalKeyHandler.ts @@ -139,7 +139,7 @@ export class KeyManager { } if (doDeselect) { SelectionManager.DeselectAll(); - LightboxView.SetLightboxDoc(undefined); + LightboxView.Instance.SetLightboxDoc(undefined); } // DictationManager.Controls.stop(); GoogleAuthenticationManager.Instance.cancel(); @@ -158,7 +158,7 @@ export class KeyManager { case 'backspace': if (document.activeElement?.tagName !== 'INPUT' && document.activeElement?.tagName !== 'TEXTAREA') { if (LightboxView.LightboxDoc) { - LightboxView.SetLightboxDoc(undefined); + LightboxView.Instance.SetLightboxDoc(undefined); SelectionManager.DeselectAll(); } else DocumentDecorations.Instance.onCloseClick(true); return { stopPropagation: true, preventDefault: true }; 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 { + 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 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: diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index edcc17afd..1da26e707 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -224,7 +224,7 @@ export class MarqueeView extends React.Component Utils.DRAG_THRESHOLD || Math.abs(this._lastY - this._downY) > Utils.DRAG_THRESHOLD) { + if (!Utils.isClick(this._lastX, this._lastY, this._downX, this._downY, Date.now())) { if (!this._commandExecuted) { this.showMarquee(); } -- cgit v1.2.3-70-g09d2