diff options
Diffstat (limited to 'apps/web/src/lib/commands/timeline/element/keyframes/update-scalar-keyframe-curve.ts')
| -rw-r--r-- | apps/web/src/lib/commands/timeline/element/keyframes/update-scalar-keyframe-curve.ts | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/apps/web/src/lib/commands/timeline/element/keyframes/update-scalar-keyframe-curve.ts b/apps/web/src/lib/commands/timeline/element/keyframes/update-scalar-keyframe-curve.ts deleted file mode 100644 index 9a4c2304..00000000 --- a/apps/web/src/lib/commands/timeline/element/keyframes/update-scalar-keyframe-curve.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { EditorCore } from "@/core"; -import { - resolveAnimationTarget, - updateScalarKeyframeCurve, -} from "@/lib/animation"; -import { Command, type CommandResult } from "@/lib/commands/base-command"; -import { updateElementInSceneTracks } from "@/lib/timeline"; -import type { - AnimationPath, - ScalarCurveKeyframePatch, -} from "@/lib/animation/types"; -import type { SceneTracks } from "@/lib/timeline"; - -export class UpdateScalarKeyframeCurveCommand extends Command { - private savedState: SceneTracks | null = null; - private readonly trackId: string; - private readonly elementId: string; - private readonly propertyPath: AnimationPath; - private readonly componentKey: string; - private readonly keyframeId: string; - private readonly patch: ScalarCurveKeyframePatch; - - constructor({ - trackId, - elementId, - propertyPath, - componentKey, - keyframeId, - patch, - }: { - trackId: string; - elementId: string; - propertyPath: AnimationPath; - componentKey: string; - keyframeId: string; - patch: ScalarCurveKeyframePatch; - }) { - super(); - this.trackId = trackId; - this.elementId = elementId; - this.propertyPath = propertyPath; - this.componentKey = componentKey; - this.keyframeId = keyframeId; - this.patch = patch; - } - - execute(): CommandResult | undefined { - const editor = EditorCore.getInstance(); - this.savedState = editor.scenes.getActiveScene().tracks; - - const updatedTracks = updateElementInSceneTracks({ - tracks: this.savedState, - trackId: this.trackId, - elementId: this.elementId, - update: (element) => { - if (!resolveAnimationTarget({ element, path: this.propertyPath })) { - return element; - } - - return { - ...element, - animations: updateScalarKeyframeCurve({ - animations: element.animations, - propertyPath: this.propertyPath, - componentKey: this.componentKey, - keyframeId: this.keyframeId, - patch: this.patch, - }), - }; - }, - }); - - editor.timeline.updateTracks(updatedTracks); - return undefined; - } - - undo(): void { - if (!this.savedState) { - return; - } - - const editor = EditorCore.getInstance(); - editor.timeline.updateTracks(this.savedState); - } -} |
