From 926a079c7745d2aac1f9a3ff31ef8cbdefdf732e Mon Sep 17 00:00:00 2001 From: Sophie Zhang Date: Wed, 1 May 2024 15:57:07 -0400 Subject: bug fiixng --- src/client/views/nodes/DocumentView.tsx | 12 +-- src/client/views/nodes/trails/PresBox.tsx | 106 ++------------------------ src/client/views/nodes/trails/SlideEffect.tsx | 32 +------- 3 files changed, 16 insertions(+), 134 deletions(-) (limited to 'src') diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index b372c1927..8c9318743 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1031,12 +1031,12 @@ export class DocumentViewInternal extends DocComponent{renderDoc} - case PresEffect.Fade: return {renderDoc} - case PresEffect.Flip: return {renderDoc} - case PresEffect.Rotate: return {renderDoc} - case PresEffect.Bounce: return {renderDoc} - case PresEffect.Roll: return {renderDoc} + case PresEffect.Zoom: return {renderDoc} + case PresEffect.Fade: return {renderDoc} + case PresEffect.Flip: return {renderDoc} + case PresEffect.Rotate: return {renderDoc} + case PresEffect.Bounce: return {renderDoc} + case PresEffect.Roll: return {renderDoc} // keep as preset, doesn't really make sense with spring config case PresEffect.Lightspeed: return {renderDoc}; } diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx index cf97dee1a..d03e2c41e 100644 --- a/src/client/views/nodes/trails/PresBox.tsx +++ b/src/client/views/nodes/trails/PresBox.tsx @@ -1994,16 +1994,13 @@ export class PresBox extends ViewBoxBaseComponent() { if (!timingConfig) { timingConfig = { type: SpringType.GENTLE, - // stiffness: 300, - // damping: 12, - // mass: 2, - stiffness: 600, + stiffness: 100, damping: 15, mass: 1, }; } - const preseEffect = (effect: PresEffect) => ( + const presEffect = (effect: PresEffect) => (
() { })}>
Movement - {/*
{ - e.stopPropagation(); - this._openMovementDropdown = !this._openMovementDropdown; - })} - style={{ - color: SettingsManager.userColor, - background: SettingsManager.userVariantColor, - borderBottomLeftRadius: this._openMovementDropdown ? 0 : 5, - border: this._openMovementDropdown ? `solid 2px ${SettingsManager.userVariantColor}` : `solid 1px ${SettingsManager.userColor}`, - }}> - {this.movementName(activeItem)} - -
- {presMovement(PresMovement.None)} - {presMovement(PresMovement.Center)} - {presMovement(PresMovement.Zoom)} - {presMovement(PresMovement.Pan)} - {presMovement(PresMovement.Jump)} -
-
*/} () {
{ - e.stopPropagation(); + onPointerDown={e => { + StopEvent(e); }}> (this._inputref = r)} + ref={r => (this._inputref2 = r)} minRows={1} placeholder="Get animation suggestions..." className="pres-chatbox" @@ -2300,72 +2267,11 @@ export class PresBox extends ViewBoxBaseComponent() { mass: elem.mass, }); }}> - +
))} - - {/*
-
- -
-
-
-
- -
-
-
-
-
-
- -
-
-
-
- -
-
-
-
*/}
{/* Effect direction */} diff --git a/src/client/views/nodes/trails/SlideEffect.tsx b/src/client/views/nodes/trails/SlideEffect.tsx index 5cb4da72c..cf31b565e 100644 --- a/src/client/views/nodes/trails/SlideEffect.tsx +++ b/src/client/views/nodes/trails/SlideEffect.tsx @@ -10,8 +10,10 @@ interface Props { doc?: Doc; dir: PresEffectDirection; presEffect: PresEffect; - friction: number; + // stiffness (figma) = tension (react-spring) tension: number; + // damping (figma) = friction (react-spring) + friction: number; mass: number; children: React.ReactNode; infinite?: boolean; @@ -285,23 +287,6 @@ export default function SpringAnimation({ doc, dir, friction, tension, mass, pre api.start(config); }; - // const flipRender = () => { - // return ( - //
- // 1 - o), transform }} /> - // - // {children} - // - //
- // ); - // }; - const getRenderDoc = () => { switch (presEffect) { case PresEffect.Rotate: @@ -365,17 +350,8 @@ export default function SpringAnimation({ doc, dir, friction, tension, mass, pre } }; - // useEffect(() => { - // // TODO: Control start with slide visibility instead - // setTimeout(() => { - // startAnimation(); - // }, 200); - // }, []); - useEffect(() => { if (infinite || !inView) return; - console.log('in view'); - // TODO: Control start with slide visibility instead setTimeout(() => { startAnimation(); }, 100); @@ -385,7 +361,7 @@ export default function SpringAnimation({ doc, dir, friction, tension, mass, pre if (infinite) { startAnimation(); } - }, []); + }, [presEffect, tension, friction, mass]); return
{getRenderDoc()}
; } -- cgit v1.2.3-70-g09d2