add transform + few fixes

feat: transform
feat: batch command
fix: slider undo
fix: timeline zoom perf
refactor: make updateElement support multiple
This commit is contained in:
Maze Winther
2026-02-08 22:21:17 +01:00
parent 484ce47867
commit e50a817b97
15 changed files with 631 additions and 262 deletions
+19 -8
View File
@@ -24,6 +24,7 @@ import {
UpdateElementStartTimeCommand,
MoveElementCommand,
} from "@/lib/commands/timeline";
import { BatchCommand } from "@/lib/commands";
import type { InsertElementParams } from "@/lib/commands/timeline/element/insert-element";
export class TimelineManager {
@@ -198,17 +199,27 @@ export class TimelineManager {
this.editor.command.execute({ command });
}
updateElement({
trackId,
elementId,
updateElements({
updates,
pushHistory = true,
}: {
trackId: string;
elementId: string;
updates: Partial<Record<string, unknown>>;
updates: Array<{
trackId: string;
elementId: string;
updates: Partial<Record<string, unknown>>;
}>;
pushHistory?: boolean;
}): void {
const command = new UpdateElementCommand(trackId, elementId, updates);
this.editor.command.execute({ command });
const commands = updates.map(
({ trackId, elementId, updates: elementUpdates }) =>
new UpdateElementCommand(trackId, elementId, elementUpdates),
);
const command = commands.length === 1 ? commands[0] : new BatchCommand(commands);
if (pushHistory) {
this.editor.command.execute({ command });
} else {
command.execute();
}
}
duplicateElements({