diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-02-08 22:21:17 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-02-08 22:21:17 +0100 |
| commit | e50a817b97b87baa0cd8fdde0fdb5d607143c1c3 (patch) | |
| tree | 8f33d19153be9a6d9fe81b1a7e7a54179ab88feb /apps/web/src/core | |
| parent | 484ce47867b1c92c83e4cfab9fa8371bb6e68e12 (diff) | |
| download | opencut-e50a817b97b87baa0cd8fdde0fdb5d607143c1c3.tar.gz | |
add transform + few fixes
feat: transform
feat: batch command
fix: slider undo
fix: timeline zoom perf
refactor: make updateElement support multiple
Diffstat (limited to 'apps/web/src/core')
| -rw-r--r-- | apps/web/src/core/managers/timeline-manager.ts | 27 |
1 files changed, 19 insertions, 8 deletions
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<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({ |
