From a496c583f375fe5e118f786b1244c42bc8a34fec Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 28 Jan 2025 14:20:40 -0500 Subject: fixed flashcard practice mode. moved doc sorting from cardDeck into collectionSubView to apply it to all collections. --- src/client/views/nodes/imageEditor/ImageEditor.tsx | 69 ++++------------------ .../views/nodes/imageEditor/ImageEditorButtons.tsx | 1 + 2 files changed, 12 insertions(+), 58 deletions(-) (limited to 'src/client/views/nodes/imageEditor') diff --git a/src/client/views/nodes/imageEditor/ImageEditor.tsx b/src/client/views/nodes/imageEditor/ImageEditor.tsx index 2ae6ee1dd..6b1d05031 100644 --- a/src/client/views/nodes/imageEditor/ImageEditor.tsx +++ b/src/client/views/nodes/imageEditor/ImageEditor.tsx @@ -551,8 +551,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc img.src = src; if (!currImg.current || !originalImg.current || !imageRootDoc) return undefined; try { - const res = await createNewImgDoc(img, false); - return res; + return await createNewImgDoc(img, false); } catch (err) { console.log(err); } @@ -589,9 +588,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc // disable once edited has been clicked (doesn't make sense to change after first edit) disabled={edited} checked={isNewCollection} - onChange={() => { - setIsNewCollection(prev => !prev); - }} + onChange={() => setIsNewCollection(prev => !prev)} /> } label="Create New Collection" @@ -610,49 +607,13 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc return (
-
- {imageEditTools.map(tool => { - return ImageToolButton(tool, tool.type === currTool.type, changeTool); - })} -
+
{imageEditTools.map(tool => ImageToolButton(tool, tool.type === currTool.type, changeTool))}
{currTool.type == ImageToolType.Cut && (
-
)}
e.stopPropagation()}> @@ -669,9 +630,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc defaultValue={genFillTool.sliderDefault} size="small" valueLabelDisplay="auto" - onChange={(e, val) => { - setCursorData(prev => ({ ...prev, width: val as number })); - }} + onChange={(e, val) => setCursorData(prev => ({ ...prev, width: val as number }))} /> )} {currTool.type === ImageToolType.Cut && ( @@ -687,9 +646,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc defaultValue={cutTool.sliderDefault} size="small" valueLabelDisplay="auto" - onChange={(e, val) => { - setCursorData(prev => ({ ...prev, width: val as number })); - }} + onChange={(e, val) => setCursorData(prev => ({ ...prev, width: val as number }))} /> )}
@@ -701,9 +658,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc e.stopPropagation(); handleUndo(); }} - onPointerUp={e => { - e.stopPropagation(); - }} + onPointerUp={e => e.stopPropagation()} color={activeColor} tooltip="Undo" icon={} @@ -714,9 +669,7 @@ const ImageEditor = ({ imageEditorOpen, imageEditorSource, imageRootDoc, addDoc e.stopPropagation(); handleRedo(); }} - onPointerUp={e => { - e.stopPropagation(); - }} + onPointerUp={e => e.stopPropagation()} color={activeColor} tooltip="Redo" icon={} diff --git a/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx b/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx index de2116253..e810881a5 100644 --- a/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx +++ b/src/client/views/nodes/imageEditor/ImageEditorButtons.tsx @@ -55,6 +55,7 @@ export function ImageToolButton(tool: ImageEditTool, isActive: boolean, selectTo return (
@@ -1952,16 +1878,16 @@ export class PresBox extends ViewBoxBaseComponent() { style={{ alignSelf: 'flex-start' }} onClick={e => { e.stopPropagation(); - this.setBezierEditorVisibility(!this.showBezierEditor); + this.setBezierEditorVisibility(!this._showBezierEditor); }}> - {`${this.showBezierEditor ? 'Hide' : 'Show'} Timing Editor`} - + {`${this._showBezierEditor ? 'Hide' : 'Show'} Timing Editor`} +
{/* Cubic bezier editor */} - {this.showBezierEditor && ( + {this._showBezierEditor && (

Custom Timing Function @@ -1978,7 +1904,7 @@ export class PresBox extends ViewBoxBaseComponent() { { this.setAnimationChat(e.target.value); }} @@ -1992,7 +1918,7 @@ export class PresBox extends ViewBoxBaseComponent() { style={{ alignSelf: 'flex-end' }} text="Send" type={Type.TERT} - icon={this.isLoading ? : } + icon={this._isLoading ? : } iconPlacement="right" color={SnappingManager.userVariantColor} onClick={this.customizeAnimations} @@ -2107,12 +2033,7 @@ export class PresBox extends ViewBoxBaseComponent() { closeOnSelect items={effectTimings} selectedVal={timingConfig.type} - setSelectedVal={val => { - this.updateEffectTiming(activeItem, { - type: val as SpringType, - ...springMappings[val], - }); - }} + setSelectedVal={val => this.updateEffectTiming(activeItem, { type: val as SpringType, ...springMappings[val] })} dropdownType={DropdownType.SELECT} type={Type.TERT} /> @@ -2120,73 +2041,61 @@ export class PresBox extends ViewBoxBaseComponent() { className="presBox-show-hide-dropdown" onClick={e => { e.stopPropagation(); - this.setSpringEditorVisibility(!this.showSpringEditor); + this.setSpringEditorVisibility(!this._showSpringEditor); }}> - {`${this.showSpringEditor ? 'Hide' : 'Show'} Spring Settings`} - + {`${this._showSpringEditor ? 'Hide' : 'Show'} Spring Settings`} +

- {this.showSpringEditor && ( + {this._showSpringEditor && ( <>
Tension
-
{ - e.stopPropagation(); - }}> - e.stopPropagation()}> + {/* prettier-ignore */} + { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number }); - }} + onChange={(e, val) => timingConfig && this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, stiffness: val as number })} valueLabelDisplay="auto" />
Damping
-
{ - e.stopPropagation(); - }}> - e.stopPropagation()}> + {/* prettier-ignore */} + { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, damping: val as number }); - }} + onChange={(e, val) => timingConfig && this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, damping: val as number })} valueLabelDisplay="auto" />
Mass
-
{ - e.stopPropagation(); - }}> - e.stopPropagation()}> + {/* prettier-ignore */} + { - if (!timingConfig) return; - this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, mass: val as number }); - }} + onChange={(e, val) => timingConfig && this.updateEffectTiming(activeItem, { ...timingConfig, type: SpringType.CUSTOM, mass: val as number })} valueLabelDisplay="auto" />
- Preview Effect -
-
- -
- +
+
{/* presbox chatbox */} - {this.chatActive &&
} + {this._chatActive &&
}
); } diff --git a/src/client/views/nodes/trails/SpringUtils.ts b/src/client/views/nodes/trails/SpringUtils.ts index 73e1e14f1..044afbeb1 100644 --- a/src/client/views/nodes/trails/SpringUtils.ts +++ b/src/client/views/nodes/trails/SpringUtils.ts @@ -22,7 +22,14 @@ export interface SpringSettings { } // Overall config - +// Keeps these settings in sync with the AnimationSettings interface (used by gpt); +export enum AnimationSettingsProperties { + effect = 'effect', + direction = 'direction', + stiffness = 'stiffness', + damping = 'damping', + mass = 'mass', +} export interface AnimationSettings { effect: PresEffect; direction: PresEffectDirection; -- cgit v1.2.3-70-g09d2