Line data Source code
1 : import { Dirty } from '#/history'
2 : import type { Command, Direction } from '#/history'
3 : import type { Transform } from '#/node'
4 :
5 : export interface TransformSlot {
6 : transform: Transform
7 : }
8 :
9 2 : export class SetTransformCommand implements Command {
10 : readonly dirtyMask = Dirty.META
11 :
12 : constructor(
13 0 : readonly label: string,
14 0 : private readonly slot: TransformSlot,
15 0 : private readonly before: Transform,
16 0 : private after: Transform
17 : ) {}
18 :
19 : apply(dir: Direction): void {
20 0 : this.slot.transform = dir === 'undo' ? this.before : this.after
21 : }
22 :
23 : sizeBytes(): number {
24 0 : return 80
25 : }
26 : }
|