blob: 24ca91053660bc0bfacbf9bdd9b747f2c25383cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
import type { EditorCore } from "@/core";
import type {
AnimationInterpolation,
AnimationPath,
ScalarCurveKeyframePatch,
SelectedKeyframeRef,
} from "@/animation/types";
import type { ParamValue } from "@/params";
import type { Command } from "@/commands/base-command";
import type {
CreateTimelineElement,
ElementRef,
TrackType,
} from "@/timeline";
import type { MediaTime } from "@/wasm";
export interface ElementClipboardItem {
trackId: string;
trackType: TrackType;
element: CreateTimelineElement;
}
export interface KeyframeClipboardCurvePatch {
componentKey: string;
patch: ScalarCurveKeyframePatch;
}
export interface KeyframeClipboardItem {
propertyPath: AnimationPath;
timeOffset: MediaTime;
value: ParamValue;
interpolation: AnimationInterpolation;
curvePatches: KeyframeClipboardCurvePatch[];
}
export interface ElementsClipboardEntry {
type: "elements";
items: ElementClipboardItem[];
}
export interface KeyframesClipboardEntry {
type: "keyframes";
sourceElement: ElementRef;
items: KeyframeClipboardItem[];
}
export interface ClipboardEntryByType {
elements: ElementsClipboardEntry;
keyframes: KeyframesClipboardEntry;
}
export type ClipboardEntry = ClipboardEntryByType[keyof ClipboardEntryByType];
export type ClipboardEntryType = keyof ClipboardEntryByType;
export interface CopyContext {
editor: EditorCore;
selectedElements: ElementRef[];
selectedKeyframes: SelectedKeyframeRef[];
}
export interface PasteContext {
editor: EditorCore;
selectedElements: ElementRef[];
selectedKeyframes: SelectedKeyframeRef[];
time: MediaTime;
}
export interface ClipboardHandler<TType extends ClipboardEntryType> {
type: TType;
canCopy(context: CopyContext): boolean;
copy(context: CopyContext): ClipboardEntryByType[TType] | null;
paste(args: {
entry: ClipboardEntryByType[TType];
context: PasteContext;
}): Command | null;
}
export type ClipboardHandlerMap = {
[TType in ClipboardEntryType]: ClipboardHandler<TType>;
};
|