forked from ZHO-ZHO-ZHO/BananaPod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
108 lines (90 loc) · 2.24 KB
/
Copy pathtypes.ts
File metadata and controls
108 lines (90 loc) · 2.24 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
export type Tool = 'select' | 'pan' | 'draw' | 'erase' | 'rectangle' | 'circle' | 'triangle' | 'text' | 'arrow' | 'highlighter' | 'lasso' | 'line';
export type WheelAction = 'zoom' | 'pan';
export type GenerationMode = 'image' | 'video';
export interface Point {
x: number;
y: number;
}
interface CanvasElementBase {
id: string;
x: number;
y: number;
name?: string;
isVisible?: boolean;
isLocked?: boolean;
parentId?: string;
}
export interface ImageElement extends CanvasElementBase {
type: 'image';
href: string;
width: number;
height: number;
mimeType: string;
borderRadius?: number;
}
export interface VideoElement extends CanvasElementBase {
type: 'video';
href: string; // Blob URL
width: number;
height: number;
mimeType: string;
}
export interface PathElement extends CanvasElementBase {
type: 'path';
points: Point[];
strokeColor: string;
strokeWidth: number;
strokeOpacity?: number;
}
export interface ShapeElement extends CanvasElementBase {
type: 'shape';
shapeType: 'rectangle' | 'circle' | 'triangle';
width: number;
height: number;
strokeColor: string;
strokeWidth: number;
fillColor: string;
borderRadius?: number;
strokeDashArray?: [number, number];
}
export interface TextElement extends CanvasElementBase {
type: 'text';
text: string;
fontSize: number;
fontColor: string;
width: number;
height: number;
}
export interface ArrowElement extends CanvasElementBase {
type: 'arrow';
points: [Point, Point];
strokeColor: string;
strokeWidth: number;
}
export interface LineElement extends CanvasElementBase {
type: 'line';
points: [Point, Point];
strokeColor: string;
strokeWidth: number;
}
export interface GroupElement extends CanvasElementBase {
type: 'group';
width: number;
height: number;
}
export type Element = ImageElement | PathElement | ShapeElement | TextElement | ArrowElement | LineElement | GroupElement | VideoElement;
export interface UserEffect {
id: string;
name: string;
value: string;
}
export interface Board {
id: string;
name: string;
elements: Element[];
history: Element[][];
historyIndex: number;
panOffset: Point;
zoom: number;
canvasBackgroundColor: string;
}