From b9fda86731a01ebfc3f21ebdd4eaf43a1c9eccc6 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 8 Oct 2024 23:07:52 -0400 Subject: yet another fix to cardView to make animations smooth - need to specifically target hidingDecorations without going using IsResizing as a hack --- src/client/util/SnappingManager.ts | 3 +++ src/client/views/DocumentDecorations.tsx | 9 +++------ src/client/views/collections/CollectionCardDeckView.tsx | 5 +++-- .../collections/collectionFreeForm/CollectionFreeFormView.tsx | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/client/util/SnappingManager.ts b/src/client/util/SnappingManager.ts index 95ccc7735..5f6c7d9ac 100644 --- a/src/client/util/SnappingManager.ts +++ b/src/client/util/SnappingManager.ts @@ -28,6 +28,7 @@ export class SnappingManager { @observable _lastBtnId: string = ''; @observable _propertyWid: number = 0; @observable _printToConsole: boolean = false; + @observable _hideDecorations: boolean = false; private constructor() { SnappingManager._manager = this; @@ -59,6 +60,7 @@ export class SnappingManager { public static get LastPressedBtn() { return this.Instance._lastBtnId; } // prettier-ignore public static get PropertiesWidth(){ return this.Instance._propertyWid; } // prettier-ignore public static get PrintToConsole() { return this.Instance._printToConsole; } // prettier-ignore + public static get HideDecorations(){ return this.Instance._hideDecorations; } // prettier-ignore public static SetLongPress = (press: boolean) => runInAction(() => {this.Instance._longPress = press}); // prettier-ignore public static SetShiftKey = (down: boolean) => runInAction(() => {this.Instance._shiftKey = down}); // prettier-ignore @@ -75,6 +77,7 @@ export class SnappingManager { public static SetLastPressedBtn = (id:string) =>runInAction(() => {this.Instance._lastBtnId = id}); // prettier-ignore public static SetPropertiesWidth= (wid:number) =>runInAction(() => {this.Instance._propertyWid = wid}); // prettier-ignore public static SetPrintToConsole = (state:boolean) =>runInAction(() => {this.Instance._printToConsole = state}); // prettier-ignore + public static SetHideDecorations= (state:boolean) =>runInAction(() => {this.Instance._hideDecorations = state}); // prettier-ignore public static userColor: string | undefined; public static userVariantColor: string | undefined; diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 1c0d51e17..62f2de776 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -63,7 +63,6 @@ export class DocumentDecorations extends ObservableReactComponent dv.ContentDiv!), dragData, e.x, e.y, { - dragComplete: action(() => { - this._hidden = false; - }), + dragComplete: () => SnappingManager.SetHideDecorations(false), hideSource: true, } ); @@ -653,7 +650,7 @@ export class DocumentDecorations extends ObservableReactComponent { this._editingTitle = false; diff --git a/src/client/views/collections/CollectionCardDeckView.tsx b/src/client/views/collections/CollectionCardDeckView.tsx index 0c2bcc580..92c69c3cf 100644 --- a/src/client/views/collections/CollectionCardDeckView.tsx +++ b/src/client/views/collections/CollectionCardDeckView.tsx @@ -22,6 +22,7 @@ import { GPTPopup, GPTPopupMode } from '../pdf/GPTPopup/GPTPopup'; import './CollectionCardDeckView.scss'; import { CollectionSubView, SubCollectionViewProps } from './CollectionSubView'; import { computedFn } from 'mobx-utils'; +import { DocumentDecorations } from '../DocumentDecorations'; enum cardSortings { Time = 'time', @@ -566,10 +567,10 @@ export class CollectionCardView extends CollectionSubView() { } else { // otherwise, turn off documentDecorations becase we're in a selection transition and want to avoid artifacts. // Turn them back on when the animation has completed and the render and backend structures are in synch - SnappingManager.SetIsResizing(doc[Id]); + SnappingManager.SetHideDecorations(true); setTimeout( action(() => { - SnappingManager.SetIsResizing(undefined); + SnappingManager.SetHideDecorations(false); this._forceChildXf++; }), 1000 diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 0cc63d632..d8678eebc 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -138,7 +138,7 @@ export class CollectionFreeFormView extends CollectionSubView