From 392143a84250df3742bc2f52d358fec25877e4de Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Thu, 6 Feb 2025 14:54:13 -0500
Subject: from last - fixes to showing ease funcs/preview only when
 appropriate.

---
 src/client/views/nodes/trails/PresBox.tsx | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

(limited to 'src/client/views/nodes/trails/PresBox.tsx')

diff --git a/src/client/views/nodes/trails/PresBox.tsx b/src/client/views/nodes/trails/PresBox.tsx
index 28afe1df4..7c23ca8e1 100644
--- a/src/client/views/nodes/trails/PresBox.tsx
+++ b/src/client/views/nodes/trails/PresBox.tsx
@@ -153,6 +153,10 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
         this.setEaseFunc(this.activeItem, `cubic-bezier(${newPoints.p1[0]}, ${newPoints.p1[1]}, ${newPoints.p2[0]}, ${newPoints.p2[1]})`);
     });
 
+    @computed get showEaseFunctions() {
+        return ![PresMovement.None, PresMovement.Jump, ''].includes(StrCast(this.activeItem?.presentation_movement) as PresMovement);
+    }
+
     @computed
     get currCPoints() {
         return EaseFuncToPoints(this.activeItem.presentation_easeFunc ? StrCast(this.activeItem.presentation_easeFunc) : 'ease');
@@ -1957,7 +1961,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
                                 </div>
                             </div>
                             {/* Easing function */}
-                            {[PresMovement.None, PresMovement.Jump, ''].includes(StrCast(activeItem.presentation_movement) as PresMovement) ? null : (
+                            {!this.showEaseFunctions ? null : (
                                 <Dropdown
                                     color={SnappingManager.userColor}
                                     formLabel="Timing"
@@ -1974,7 +1978,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
                     </div>
 
                     {/* Cubic bezier editor */}
-                    {StrCast(activeItem.presentation_easeFunc).includes('cubic-bezier') && (
+                    {this.showEaseFunctions && StrCast(activeItem.presentation_easeFunc).includes('cubic-bezier') && (
                         <div className="presBox-option-block" style={{ paddingTop: 0, alignItems: 'center' }}>
                             <CubicBezierEditor setFunc={this.setBezierControlPoints} currPoints={this.currCPoints} />
                         </div>
@@ -2066,7 +2070,7 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
                                         </div>
                                     </div>
                                 )}
-                                {effect !== PresEffect.Lightspeed && (
+                                {![PresEffect.Lightspeed, PresEffect.Fade, PresEffect.None, ''].includes(effect) && (
                                     <>
                                         <Dropdown
                                             color={SnappingManager.userColor}
@@ -2089,10 +2093,10 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
                                                         <div onPointerDown={e => e.stopPropagation()}>
                                                             {/* prettier-ignore */}
                                                             <Slider min={1} max={1000} step={5} size="small" 
-                                                        value={timingConfig.stiffness}
-                                                        onChange={(e, val) => timingConfig && this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number })}
-                                                        valueLabelDisplay="auto"
-                                                    />
+                                                                value={timingConfig.stiffness}
+                                                                onChange={(e, val) => timingConfig && this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number })}
+                                                                valueLabelDisplay="auto"
+                                                            />
                                                         </div>
                                                     </div>
                                                     <div className="presBox-springSlider">
@@ -2126,14 +2130,14 @@ export class PresBox extends ViewBoxBaseComponent<FieldViewProps>() {
                         </div>
                     </div>
 
-                    {effect === PresEffect.None ? null : (
+                    {[PresEffect.None, PresEffect.Fade, ''].includes(effect) ? null : (
                         <div className="presBox-previewContainer">
                             <Button
                                 type={Type.TERT}
                                 tooltip="show preview of slide animation effect"
                                 size={Size.SMALL}
                                 color={SnappingManager.userColor}
-                                background={'transparent'}
+                                background="transparent"
                                 onClick={action(() => {
                                     this._showPreview = false;
                                     setTimeout(action(() => { this._showPreview = true; }) ); // prettier-ignore
-- 
cgit v1.2.3-70-g09d2

