@yorab/react-paint 0.16.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
21
21
  center: Point;
22
22
  boundingBox: import("./../../common/types/Shapes").Rect;
23
23
  };
24
+ path?: Path2D | undefined;
24
25
  } & {
25
26
  rotation?: number;
26
27
  toolId?: string;
@@ -31,7 +32,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
31
32
  type: "line";
32
33
  } & {
33
34
  selection?: import("./../../common/types/Shapes").SelectionLinesType | undefined;
34
- path?: Path2D | undefined;
35
35
  arrows?: import("./../../common/types/Shapes").TriangleEntity[];
36
36
  type: "line";
37
37
  }) | ({
@@ -42,6 +42,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
42
42
  center: Point;
43
43
  boundingBox: import("./../../common/types/Shapes").Rect;
44
44
  };
45
+ path?: Path2D | undefined;
45
46
  } & {
46
47
  rotation?: number;
47
48
  toolId?: string;
@@ -54,6 +55,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
54
55
  img: HTMLImageElement;
55
56
  flipX?: boolean;
56
57
  flipY?: boolean;
58
+ ratio?: number;
57
59
  type: "picture";
58
60
  } & {
59
61
  img: HTMLImageElement;
@@ -67,6 +69,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
67
69
  center: Point;
68
70
  boundingBox: import("./../../common/types/Shapes").Rect;
69
71
  };
72
+ path?: Path2D | undefined;
70
73
  } & {
71
74
  rotation?: number;
72
75
  toolId?: string;
@@ -79,6 +82,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
79
82
  } & {
80
83
  flipX?: boolean;
81
84
  flipY?: boolean;
85
+ ratio?: number;
82
86
  type: "text";
83
87
  } & {
84
88
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
@@ -91,6 +95,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
91
95
  center: Point;
92
96
  boundingBox: import("./../../common/types/Shapes").Rect;
93
97
  };
98
+ path?: Path2D | undefined;
94
99
  } & {
95
100
  rotation?: number;
96
101
  toolId?: string;
@@ -101,7 +106,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
101
106
  type: "rect";
102
107
  } & {
103
108
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
104
- path?: Path2D | undefined;
105
109
  type: "rect";
106
110
  }) | ({
107
111
  id: string;
@@ -111,6 +115,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
111
115
  center: Point;
112
116
  boundingBox: import("./../../common/types/Shapes").Rect;
113
117
  };
118
+ path?: Path2D | undefined;
114
119
  } & {
115
120
  rotation?: number;
116
121
  toolId?: string;
@@ -121,7 +126,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
121
126
  type: "square";
122
127
  } & {
123
128
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
124
- path?: Path2D | undefined;
125
129
  type: "square";
126
130
  }) | ({
127
131
  id: string;
@@ -131,6 +135,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
131
135
  center: Point;
132
136
  boundingBox: import("./../../common/types/Shapes").Rect;
133
137
  };
138
+ path?: Path2D | undefined;
134
139
  } & {
135
140
  rotation?: number;
136
141
  toolId?: string;
@@ -141,7 +146,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
141
146
  type: "circle";
142
147
  } & {
143
148
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
144
- path?: Path2D | undefined;
145
149
  type: "circle";
146
150
  }) | ({
147
151
  id: string;
@@ -151,6 +155,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
151
155
  center: Point;
152
156
  boundingBox: import("./../../common/types/Shapes").Rect;
153
157
  };
158
+ path?: Path2D | undefined;
154
159
  } & {
155
160
  rotation?: number;
156
161
  toolId?: string;
@@ -161,7 +166,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
161
166
  type: "ellipse";
162
167
  } & {
163
168
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
164
- path?: Path2D | undefined;
165
169
  type: "ellipse";
166
170
  }) | ({
167
171
  id: string;
@@ -171,6 +175,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
171
175
  center: Point;
172
176
  boundingBox: import("./../../common/types/Shapes").Rect;
173
177
  };
178
+ path?: Path2D | undefined;
174
179
  } & {
175
180
  rotation?: number;
176
181
  toolId?: string;
@@ -181,7 +186,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
181
186
  type: "polygon";
182
187
  } & {
183
188
  selection?: import("./../../common/types/Shapes").SelectionLinesType | undefined;
184
- path?: Path2D | undefined;
185
189
  type: "polygon";
186
190
  }) | ({
187
191
  id: string;
@@ -191,6 +195,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
191
195
  center: Point;
192
196
  boundingBox: import("./../../common/types/Shapes").Rect;
193
197
  };
198
+ path?: Path2D | undefined;
194
199
  } & {
195
200
  rotation?: number;
196
201
  toolId?: string;
@@ -201,7 +206,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
201
206
  type: "curve";
202
207
  } & {
203
208
  selection?: import("./../../common/types/Shapes").SelectionLinesType | undefined;
204
- path?: Path2D | undefined;
205
209
  type: "curve";
206
210
  }) | ({
207
211
  id: string;
@@ -211,6 +215,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
211
215
  center: Point;
212
216
  boundingBox: import("./../../common/types/Shapes").Rect;
213
217
  };
218
+ path?: Path2D | undefined;
214
219
  } & {
215
220
  rotation?: number;
216
221
  toolId?: string;
@@ -223,7 +228,6 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
223
228
  scaleY?: number;
224
229
  } & {
225
230
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
226
- path?: Path2D | undefined;
227
231
  type: "brush";
228
232
  }) | ({
229
233
  id: string;
@@ -233,6 +237,7 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
233
237
  center: Point;
234
238
  boundingBox: import("./../../common/types/Shapes").Rect;
235
239
  };
240
+ path?: Path2D | undefined;
236
241
  } & {
237
242
  rotation?: number;
238
243
  toolId?: string;
@@ -244,6 +249,5 @@ export declare const decodeImportedData: (shapesForJson: ExportedDrawableShape[]
244
249
  type: "group";
245
250
  } & {
246
251
  selection?: import("./../../common/types/Shapes").SelectionDefaultType | undefined;
247
- path?: Path2D | undefined;
248
252
  type: "group";
249
253
  }))[]>;
@@ -20,4 +20,4 @@ export declare const checkCurveLinesSelectionIntersection: (ctx: CanvasRendering
20
20
  };
21
21
  export declare const checkPositionIntersection: (ctx: CanvasRenderingContext2D, shape: SelectionType, position: Point, settings: UtilsSettings) => false | HoverModeData;
22
22
  export declare function getRectIntersection(rect1: Rect, rect2: Rect): Rect | undefined;
23
- export declare const checkSelectionFrameCollision: (ctx: CanvasRenderingContext2D, shape: ShapeEntity, selectionFrame: [Point, Point], settings: UtilsSettings) => boolean;
23
+ export declare const checkSelectionFrameCollision: (ctx: CanvasRenderingContext2D, shape: ShapeEntity, selectionFrame: [Point, Point]) => boolean;
@@ -77,10 +77,12 @@ export type DrawableShape<T extends ShapeType = ShapeType> = {
77
77
  img: HTMLImageElement;
78
78
  flipX?: boolean;
79
79
  flipY?: boolean;
80
+ ratio?: number;
80
81
  type: 'picture';
81
82
  } : T extends 'text' ? Text & {
82
83
  flipX?: boolean;
83
84
  flipY?: boolean;
85
+ ratio?: number;
84
86
  type: 'text';
85
87
  } : T extends 'rect' ? Rect & {
86
88
  type: 'rect';
@@ -122,9 +124,9 @@ export type ShapeEntity<T extends Exclude<ShapeType, 'triangle'> = Exclude<Shape
122
124
  center: Point;
123
125
  boundingBox: Rect;
124
126
  };
127
+ path?: Path2D | undefined;
125
128
  } & DrawableShape<T> & (T extends 'line' ? {
126
129
  selection?: SelectionLinesType | undefined;
127
- path?: Path2D | undefined;
128
130
  arrows?: TriangleEntity[];
129
131
  type: 'line';
130
132
  } : T extends 'picture' ? {
@@ -136,35 +138,27 @@ export type ShapeEntity<T extends Exclude<ShapeType, 'triangle'> = Exclude<Shape
136
138
  type: 'text';
137
139
  } : T extends 'rect' ? {
138
140
  selection?: SelectionDefaultType | undefined;
139
- path?: Path2D | undefined;
140
141
  type: 'rect';
141
142
  } : T extends 'square' ? {
142
143
  selection?: SelectionDefaultType | undefined;
143
- path?: Path2D | undefined;
144
144
  type: 'square';
145
145
  } : T extends 'circle' ? {
146
146
  selection?: SelectionDefaultType | undefined;
147
- path?: Path2D | undefined;
148
147
  type: 'circle';
149
148
  } : T extends 'ellipse' ? {
150
149
  selection?: SelectionDefaultType | undefined;
151
- path?: Path2D | undefined;
152
150
  type: 'ellipse';
153
151
  } : T extends 'polygon' ? {
154
152
  selection?: SelectionLinesType | undefined;
155
- path?: Path2D | undefined;
156
153
  type: 'polygon';
157
154
  } : T extends 'curve' ? {
158
155
  selection?: SelectionLinesType | undefined;
159
- path?: Path2D | undefined;
160
156
  type: 'curve';
161
157
  } : T extends 'brush' ? {
162
158
  selection?: SelectionDefaultType | undefined;
163
- path?: Path2D | undefined;
164
159
  type: 'brush';
165
160
  } : T extends 'group' ? {
166
161
  selection?: SelectionDefaultType | undefined;
167
- path?: Path2D | undefined;
168
162
  type: 'group';
169
163
  } : never);
170
164
  export type StateData = {