mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
refactor: update command execute methods to return CommandResult | undefined
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import type { MediaAsset } from "@/lib/media/types";
|
import type { MediaAsset } from "@/lib/media/types";
|
||||||
@@ -23,7 +23,7 @@ export class AddMediaAssetCommand extends Command {
|
|||||||
this.assetId = generateUUID();
|
this.assetId = generateUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedAssets = [...editor.media.getAssets()];
|
this.savedAssets = [...editor.media.getAssets()];
|
||||||
|
|
||||||
@@ -80,6 +80,8 @@ export class AddMediaAssetCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { MediaAsset } from "@/lib/media/types";
|
import type { MediaAsset } from "@/lib/media/types";
|
||||||
import { storageService } from "@/services/storage/service";
|
import { storageService } from "@/services/storage/service";
|
||||||
@@ -18,7 +18,7 @@ export class RemoveMediaAssetCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const assets = editor.media.getAssets();
|
const assets = editor.media.getAssets();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TProject, TProjectSettings } from "@/lib/project/types";
|
import type { TProject, TProjectSettings } from "@/lib/project/types";
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ export class UpdateProjectSettingsCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const activeProject = editor.project.getActive();
|
const activeProject = editor.project.getActive();
|
||||||
if (!activeProject) return;
|
if (!activeProject) return;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { buildDefaultScene } from "@/lib/scenes";
|
import { buildDefaultScene } from "@/lib/scenes";
|
||||||
@@ -14,7 +14,7 @@ export class CreateSceneCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedScenes = [...editor.scenes.getScenes()];
|
this.savedScenes = [...editor.scenes.getScenes()];
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ export class CreateSceneCommand extends Command {
|
|||||||
|
|
||||||
const updatedScenes = [...this.savedScenes, this.createdScene];
|
const updatedScenes = [...this.savedScenes, this.createdScene];
|
||||||
editor.scenes.setScenes({ scenes: updatedScenes });
|
editor.scenes.setScenes({ scenes: updatedScenes });
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { canDeleteScene, getFallbackSceneAfterDelete } from "@/lib/scenes";
|
import { canDeleteScene, getFallbackSceneAfterDelete } from "@/lib/scenes";
|
||||||
@@ -12,7 +12,7 @@ export class DeleteSceneCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const scenes = editor.scenes.getScenes();
|
const scenes = editor.scenes.getScenes();
|
||||||
const activeScene = editor.scenes.getActiveScene();
|
const activeScene = editor.scenes.getActiveScene();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { updateSceneInArray } from "@/lib/scenes";
|
import { updateSceneInArray } from "@/lib/scenes";
|
||||||
@@ -14,7 +14,7 @@ export class MoveBookmarkCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const activeScene = editor.scenes.getActiveScene();
|
const activeScene = editor.scenes.getActiveScene();
|
||||||
const activeProject = editor.project.getActive();
|
const activeProject = editor.project.getActive();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { updateSceneInArray } from "@/lib/scenes";
|
import { updateSceneInArray } from "@/lib/scenes";
|
||||||
@@ -15,7 +15,7 @@ export class RemoveBookmarkCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const activeScene = editor.scenes.getActiveScene();
|
const activeScene = editor.scenes.getActiveScene();
|
||||||
const activeProject = editor.project.getActive();
|
const activeProject = editor.project.getActive();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { updateSceneInArray } from "@/lib/scenes";
|
import { updateSceneInArray } from "@/lib/scenes";
|
||||||
@@ -14,7 +14,7 @@ export class RenameSceneCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const scenes = editor.scenes.getScenes();
|
const scenes = editor.scenes.getScenes();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TScene } from "@/lib/timeline";
|
import type { TScene } from "@/lib/timeline";
|
||||||
import { updateSceneInArray } from "@/lib/scenes";
|
import { updateSceneInArray } from "@/lib/scenes";
|
||||||
@@ -12,7 +12,7 @@ export class ToggleBookmarkCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const activeScene = editor.scenes.getActiveScene();
|
const activeScene = editor.scenes.getActiveScene();
|
||||||
const activeProject = editor.project.getActive();
|
const activeProject = editor.project.getActive();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { Bookmark, TScene } from "@/lib/timeline";
|
import type { Bookmark, TScene } from "@/lib/timeline";
|
||||||
import { updateSceneInArray } from "@/lib/scenes";
|
import { updateSceneInArray } from "@/lib/scenes";
|
||||||
@@ -14,7 +14,7 @@ export class UpdateBookmarkCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
const activeScene = editor.scenes.getActiveScene();
|
const activeScene = editor.scenes.getActiveScene();
|
||||||
const activeProject = editor.project.getActive();
|
const activeProject = editor.project.getActive();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export class PasteCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
execute(): CommandResult | undefined {
|
execute(): CommandResult | undefined {
|
||||||
if (this.clipboardItems.length === 0) return;
|
if (this.clipboardItems.length === 0) return undefined;
|
||||||
|
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
@@ -123,6 +123,7 @@ export class PasteCommand extends Command {
|
|||||||
if (this.pastedElements.length > 0) {
|
if (this.pastedElements.length > 0) {
|
||||||
return { select: this.pastedElements };
|
return { select: this.pastedElements };
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class DeleteElementsCommand extends Command {
|
|||||||
this.rippleEnabled = rippleEnabled;
|
this.rippleEnabled = rippleEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): CommandResult {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ export class DuplicateElementsCommand extends Command {
|
|||||||
select: this.duplicatedElements,
|
select: this.duplicatedElements,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
||||||
@@ -38,7 +38,7 @@ export class AddClipEffectCommand extends Command {
|
|||||||
this.effectType = effectType;
|
this.effectType = effectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -59,6 +59,7 @@ export class AddClipEffectCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
||||||
@@ -36,7 +36,7 @@ export class RemoveClipEffectCommand extends Command {
|
|||||||
this.effectId = effectId;
|
this.effectId = effectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -54,6 +54,7 @@ export class RemoveClipEffectCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
||||||
@@ -43,7 +43,7 @@ export class ReorderClipEffectsCommand extends Command {
|
|||||||
this.toIndex = toIndex;
|
this.toIndex = toIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -62,6 +62,7 @@ export class ReorderClipEffectsCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
import type { TimelineTrack, VisualElement } from "@/lib/timeline";
|
||||||
@@ -38,7 +38,7 @@ export class ToggleClipEffectCommand extends Command {
|
|||||||
this.effectId = effectId;
|
this.effectId = effectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -56,6 +56,7 @@ export class ToggleClipEffectCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
import { isVisualElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { ParamValues } from "@/lib/params";
|
import type { ParamValues } from "@/lib/params";
|
||||||
@@ -56,7 +56,7 @@ export class UpdateClipEffectParamsCommand extends Command {
|
|||||||
this.params = params;
|
this.params = params;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -75,6 +75,7 @@ export class UpdateClipEffectParamsCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export { ToggleElementsVisibilityCommand } from "./toggle-elements-visibility";
|
|||||||
export { ToggleElementsMutedCommand } from "./toggle-elements-muted";
|
export { ToggleElementsMutedCommand } from "./toggle-elements-muted";
|
||||||
export { ToggleSourceAudioSeparationCommand } from "./toggle-source-audio-separation";
|
export { ToggleSourceAudioSeparationCommand } from "./toggle-source-audio-separation";
|
||||||
export { MoveElementCommand } from "./move-elements";
|
export { MoveElementCommand } from "./move-elements";
|
||||||
|
|
||||||
export * from "./keyframes";
|
export * from "./keyframes";
|
||||||
export * from "./effects";
|
export * from "./effects";
|
||||||
export * from "./masks";
|
export * from "./masks";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type {
|
import type {
|
||||||
CreateTimelineElement,
|
CreateTimelineElement,
|
||||||
@@ -42,7 +42,7 @@ export class InsertElementCommand extends Command {
|
|||||||
private element: CreateTimelineElement;
|
private element: CreateTimelineElement;
|
||||||
private placement: InsertElementPlacement;
|
private placement: InsertElementPlacement;
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { removeEffectParamKeyframe } from "@/lib/animation/effect-param-channel";
|
import { removeEffectParamKeyframe } from "@/lib/animation/effect-param-channel";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
import { isVisualElement } from "@/lib/timeline/element-utils";
|
import { isVisualElement } from "@/lib/timeline/element-utils";
|
||||||
@@ -34,7 +34,7 @@ export class RemoveEffectParamKeyframeCommand extends Command {
|
|||||||
this.keyframeId = keyframeId;
|
this.keyframeId = keyframeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -55,6 +55,7 @@ export class RemoveEffectParamKeyframeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
removeElementKeyframe,
|
removeElementKeyframe,
|
||||||
resolveAnimationTarget,
|
resolveAnimationTarget,
|
||||||
} from "@/lib/animation";
|
} from "@/lib/animation";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { AnimationPath, AnimationValue } from "@/lib/animation/types";
|
import type { AnimationPath, AnimationValue } from "@/lib/animation/types";
|
||||||
import type { TimelineElement, TimelineTrack } from "@/lib/timeline";
|
import type { TimelineElement, TimelineTrack } from "@/lib/timeline";
|
||||||
@@ -108,7 +108,7 @@ export class RemoveKeyframeCommand extends Command {
|
|||||||
this.keyframeId = keyframeId;
|
this.keyframeId = keyframeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -125,6 +125,7 @@ export class RemoveKeyframeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { resolveAnimationTarget, retimeElementKeyframe } from "@/lib/animation";
|
import { resolveAnimationTarget, retimeElementKeyframe } from "@/lib/animation";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { AnimationPath } from "@/lib/animation/types";
|
import type { AnimationPath } from "@/lib/animation/types";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
@@ -34,7 +34,7 @@ export class RetimeKeyframeCommand extends Command {
|
|||||||
this.nextTime = nextTime;
|
this.nextTime = nextTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -61,6 +61,7 @@ export class RetimeKeyframeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { upsertEffectParamKeyframe } from "@/lib/animation/effect-param-channel";
|
import { upsertEffectParamKeyframe } from "@/lib/animation/effect-param-channel";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
import { isVisualElement } from "@/lib/timeline/element-utils";
|
import { isVisualElement } from "@/lib/timeline/element-utils";
|
||||||
@@ -46,7 +46,7 @@ export class UpsertEffectParamKeyframeCommand extends Command {
|
|||||||
this.keyframeId = keyframeId;
|
this.keyframeId = keyframeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -71,6 +71,7 @@ export class UpsertEffectParamKeyframeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { resolveAnimationTarget, upsertPathKeyframe } from "@/lib/animation";
|
import { resolveAnimationTarget, upsertPathKeyframe } from "@/lib/animation";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
@@ -46,7 +46,7 @@ export class UpsertKeyframeCommand extends Command {
|
|||||||
this.keyframeId = keyframeId;
|
this.keyframeId = keyframeId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -82,6 +82,7 @@ export class UpsertKeyframeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { isMaskableElement, updateElementInTracks } from "@/lib/timeline";
|
import { isMaskableElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { TimelineTrack, MaskableElement } from "@/lib/timeline";
|
import type { TimelineTrack, MaskableElement } from "@/lib/timeline";
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ export class RemoveMaskCommand extends Command {
|
|||||||
this.maskId = maskId;
|
this.maskId = maskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -53,6 +53,7 @@ export class RemoveMaskCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { isMaskableElement, updateElementInTracks } from "@/lib/timeline";
|
import { isMaskableElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { Mask } from "@/lib/masks/types";
|
import type { Mask } from "@/lib/masks/types";
|
||||||
import type { TimelineTrack, MaskableElement } from "@/lib/timeline";
|
import type { TimelineTrack, MaskableElement } from "@/lib/timeline";
|
||||||
@@ -47,7 +47,7 @@ export class ToggleMaskInvertedCommand extends Command {
|
|||||||
this.maskId = maskId;
|
this.maskId = maskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -64,6 +64,7 @@ export class ToggleMaskInvertedCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type {
|
import type {
|
||||||
TimelineTrack,
|
TimelineTrack,
|
||||||
@@ -45,7 +45,7 @@ export class MoveElementCommand extends Command {
|
|||||||
this.rippleEnabled = rippleEnabled;
|
this.rippleEnabled = rippleEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -134,6 +134,7 @@ export class MoveElementCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { clampRetimeRate } from "@/lib/retime/rate";
|
import { clampRetimeRate } from "@/lib/retime/rate";
|
||||||
import { clampAnimationsToDuration } from "@/lib/animation";
|
import { clampAnimationsToDuration } from "@/lib/animation";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { getTimelineDurationForSourceSpan, getSourceSpanAtClipTime } from "@/lib/retime";
|
import { getTimelineDurationForSourceSpan, getSourceSpanAtClipTime } from "@/lib/retime";
|
||||||
import { isRetimableElement, updateElementInTracks } from "@/lib/timeline";
|
import { isRetimableElement, updateElementInTracks } from "@/lib/timeline";
|
||||||
import type { RetimeConfig, TimelineTrack } from "@/lib/timeline";
|
import type { RetimeConfig, TimelineTrack } from "@/lib/timeline";
|
||||||
@@ -54,7 +54,7 @@ export class UpdateElementRetimeCommand extends Command {
|
|||||||
this.retime = retime;
|
this.retime = retime;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -103,6 +103,7 @@ export class UpdateElementRetimeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ export class SplitElementsCommand extends Command {
|
|||||||
select: this.rightSideElements,
|
select: this.rightSideElements,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { canElementHaveAudio } from "@/lib/timeline/element-utils";
|
import { canElementHaveAudio } from "@/lib/timeline/element-utils";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
@@ -10,7 +10,7 @@ export class ToggleElementsMutedCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { canElementBeHidden } from "@/lib/timeline/element-utils";
|
import { canElementBeHidden } from "@/lib/timeline/element-utils";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
@@ -10,7 +10,7 @@ export class ToggleElementsVisibilityCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ export class ToggleElementsVisibilityCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import {
|
import {
|
||||||
buildSeparatedAudioElement,
|
buildSeparatedAudioElement,
|
||||||
canExtractSourceAudio,
|
canExtractSourceAudio,
|
||||||
@@ -25,7 +25,7 @@ export class ToggleSourceAudioSeparationCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -43,6 +43,9 @@ export class ToggleSourceAudioSeparationCommand extends Command {
|
|||||||
if (!sourceElement) {
|
if (!sourceElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (sourceElement.type !== "video") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (canRecoverSourceAudio({ element: sourceElement })) {
|
if (canRecoverSourceAudio({ element: sourceElement })) {
|
||||||
editor.timeline.updateTracks(
|
editor.timeline.updateTracks(
|
||||||
@@ -59,9 +62,7 @@ export class ToggleSourceAudioSeparationCommand extends Command {
|
|||||||
const mediaAsset = editor
|
const mediaAsset = editor
|
||||||
.media
|
.media
|
||||||
.getAssets()
|
.getAssets()
|
||||||
.find((asset) =>
|
.find((asset) => asset.id === sourceElement.mediaId);
|
||||||
sourceElement.type === "video" ? asset.id === sourceElement.mediaId : false,
|
|
||||||
);
|
|
||||||
if (!canExtractSourceAudio({ element: sourceElement, mediaAsset })) {
|
if (!canExtractSourceAudio({ element: sourceElement, mediaAsset })) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { clampAnimationsToDuration } from "@/lib/animation";
|
import { clampAnimationsToDuration } from "@/lib/animation";
|
||||||
@@ -24,7 +24,7 @@ export class UpdateElementDurationCommand extends Command {
|
|||||||
this.duration = duration;
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ export class UpdateElementDurationCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { enforceMainTrackStart } from "@/lib/timeline/placement";
|
import { enforceMainTrackStart } from "@/lib/timeline/placement";
|
||||||
@@ -20,7 +20,7 @@ export class UpdateElementStartTimeCommand extends Command {
|
|||||||
this.startTime = startTime;
|
this.startTime = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -58,6 +58,7 @@ export class UpdateElementStartTimeCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { clampAnimationsToDuration } from "@/lib/animation";
|
import { clampAnimationsToDuration } from "@/lib/animation";
|
||||||
@@ -38,7 +38,7 @@ export class UpdateElementTrimCommand extends Command {
|
|||||||
this.rippleEnabled = rippleEnabled;
|
this.rippleEnabled = rippleEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -104,6 +104,7 @@ export class UpdateElementTrimCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineElement, TimelineTrack } from "@/lib/timeline";
|
import type { TimelineElement, TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { updateElementInTracks } from "@/lib/timeline";
|
import { updateElementInTracks } from "@/lib/timeline";
|
||||||
@@ -24,7 +24,7 @@ export class UpdateElementCommand extends Command {
|
|||||||
this.updates = updates;
|
this.updates = updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ export class UpdateElementCommand extends Command {
|
|||||||
});
|
});
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TrackType, TimelineTrack } from "@/lib/timeline";
|
import type { TrackType, TimelineTrack } from "@/lib/timeline";
|
||||||
import { generateUUID } from "@/utils/id";
|
import { generateUUID } from "@/utils/id";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
@@ -19,7 +19,7 @@ export class AddTrackCommand extends Command {
|
|||||||
this.trackId = generateUUID();
|
this.trackId = generateUUID();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
@@ -38,6 +38,7 @@ export class AddTrackCommand extends Command {
|
|||||||
updatedTracks.splice(insertIndex, 0, newTrack);
|
updatedTracks.splice(insertIndex, 0, newTrack);
|
||||||
|
|
||||||
editor.timeline.updateTracks(updatedTracks);
|
editor.timeline.updateTracks(updatedTracks);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { getMainTrack } from "@/lib/timeline/placement";
|
import { getMainTrack } from "@/lib/timeline/placement";
|
||||||
@@ -10,7 +10,7 @@ export class RemoveTrackCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
const targetTrack = this.savedState.find(
|
const targetTrack = this.savedState.find(
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { canTrackHaveAudio } from "@/lib/timeline";
|
import { canTrackHaveAudio } from "@/lib/timeline";
|
||||||
@@ -10,7 +10,7 @@ export class ToggleTrackMuteCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
import { canTrackBeHidden } from "@/lib/timeline";
|
import { canTrackBeHidden } from "@/lib/timeline";
|
||||||
@@ -10,7 +10,7 @@ export class ToggleTrackVisibilityCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
const editor = EditorCore.getInstance();
|
const editor = EditorCore.getInstance();
|
||||||
this.savedState = editor.timeline.getTracks();
|
this.savedState = editor.timeline.getTracks();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Command } from "@/lib/commands/base-command";
|
import { Command, type CommandResult } from "@/lib/commands/base-command";
|
||||||
import type { TimelineTrack } from "@/lib/timeline";
|
import type { TimelineTrack } from "@/lib/timeline";
|
||||||
import { EditorCore } from "@/core";
|
import { EditorCore } from "@/core";
|
||||||
|
|
||||||
@@ -10,8 +10,9 @@ export class TracksSnapshotCommand extends Command {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
execute(): void {
|
execute(): CommandResult | undefined {
|
||||||
EditorCore.getInstance().timeline.updateTracks(this.after);
|
EditorCore.getInstance().timeline.updateTracks(this.after);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
undo(): void {
|
undo(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user