From e50a817b97b87baa0cd8fdde0fdb5d607143c1c3 Mon Sep 17 00:00:00 2001 From: Maze Winther Date: Sun, 8 Feb 2026 22:21:17 +0100 Subject: add transform + few fixes feat: transform feat: batch command fix: slider undo fix: timeline zoom perf refactor: make updateElement support multiple --- apps/web/src/core/managers/timeline-manager.ts | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'apps/web/src/core/managers') diff --git a/apps/web/src/core/managers/timeline-manager.ts b/apps/web/src/core/managers/timeline-manager.ts index 22cba52d..ad9f7792 100644 --- a/apps/web/src/core/managers/timeline-manager.ts +++ b/apps/web/src/core/managers/timeline-manager.ts @@ -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>; + updates: Array<{ + trackId: string; + elementId: string; + updates: Partial>; + }>; + 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({ -- cgit v1.3.1