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/lib/commands/batch-command.ts | 25 +++++++++++++++++++++++++ apps/web/src/lib/commands/index.ts | 1 + 2 files changed, 26 insertions(+) create mode 100644 apps/web/src/lib/commands/batch-command.ts (limited to 'apps/web/src/lib') diff --git a/apps/web/src/lib/commands/batch-command.ts b/apps/web/src/lib/commands/batch-command.ts new file mode 100644 index 00000000..05b51d38 --- /dev/null +++ b/apps/web/src/lib/commands/batch-command.ts @@ -0,0 +1,25 @@ +import { Command } from "./base-command"; + +export class BatchCommand extends Command { + constructor(private commands: Command[]) { + super(); + } + + execute(): void { + for (const command of this.commands) { + command.execute(); + } + } + + undo(): void { + for (const command of [...this.commands].reverse()) { + command.undo(); + } + } + + redo(): void { + for (const command of this.commands) { + command.execute(); + } + } +} diff --git a/apps/web/src/lib/commands/index.ts b/apps/web/src/lib/commands/index.ts index 6700087b..03de07c4 100644 --- a/apps/web/src/lib/commands/index.ts +++ b/apps/web/src/lib/commands/index.ts @@ -1,4 +1,5 @@ export { Command } from "./base-command"; +export { BatchCommand } from "./batch-command"; export * from "./timeline"; export * from "./media"; -- cgit v1.3.1