From ea55659c15031fc4edc717b7c900f8d3f029f2f8 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 15 May 2024 10:02:52 -0400 Subject: Make pres aniamtions last as long as their transition time --- src/client/views/nodes/DocumentView.tsx | 7 +++---- src/client/views/nodes/trails/SlideEffect.tsx | 6 +++--- src/fields/Doc.ts | 4 +++- 3 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 350f0db76..c564e66e5 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1030,15 +1030,14 @@ export class DocumentViewInternal extends DocComponent{renderDoc} - case PresEffect.Fade: return {renderDoc} + case PresEffect.Fade: return {renderDoc} case PresEffect.Flip: return {renderDoc} - case PresEffect.Rotate: return {renderDoc} + case PresEffect.Rotate: return {renderDoc} case PresEffect.Bounce: return {renderDoc} - case PresEffect.Roll: return {renderDoc} + case PresEffect.Roll: return {renderDoc} // keep as preset, doesn't really make sense with spring config case PresEffect.Lightspeed: return {renderDoc}; } // prettier-ignore - } public static recordAudioAnnotation(dataDoc: Doc, field: string, onRecording?: (stop: () => void) => void, onEnd?: () => void) { let gumStream: any; diff --git a/src/client/views/nodes/trails/SlideEffect.tsx b/src/client/views/nodes/trails/SlideEffect.tsx index e1cf9b127..bad1fd8fa 100644 --- a/src/client/views/nodes/trails/SlideEffect.tsx +++ b/src/client/views/nodes/trails/SlideEffect.tsx @@ -41,9 +41,9 @@ export default function SpringAnimation({ doc, dir, friction, tension, mass, pre scale: 1, }, config: { - tension: tension, - friction: friction, - mass: mass, + tension, + friction, + mass, }, onStart: () => {}, onRest: () => {}, diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index 48214cf25..16aeb9abe 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1276,10 +1276,12 @@ export namespace Doc { document.removeEventListener('pointerdown', linkFollowUnhighlight); document.addEventListener('pointerdown', linkFollowUnhighlight); if (UnhighlightTimer) clearTimeout(UnhighlightTimer); + const presTransition = Number(presentation_effect?.presentation_transition); + const duration = isNaN(presTransition) ? 5000 : presTransition; UnhighlightTimer = window.setTimeout(() => { linkFollowUnhighlight(); UnhighlightTimer = 0; - }, 5000); + }, duration); } export var highlightedDocs = new ObservableSet(); -- cgit v1.2.3-70-g09d2