@yorab/react-paint 0.8.0 → 0.9.0
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.
- package/README.md +1 -11
- package/dist/components/Canvas.d.ts +6 -6
- package/dist/components/settings/DeleteButton.d.ts +3 -3
- package/dist/components/settings/Layouts.d.ts +7 -7
- package/dist/components/settings/SettingsBar.d.ts +7 -5
- package/dist/components/toolbox/EditTextBox.d.ts +2 -2
- package/dist/components/toolbox/Tool.d.ts +2 -2
- package/dist/constants/shapes.d.ts +1 -1
- package/dist/constants/style.d.ts +1 -1
- package/dist/hooks/useDrag.d.ts +3 -3
- package/dist/hooks/useDrawableCanvas.d.ts +6 -6
- package/dist/hooks/useKeyboard.d.ts +9 -7
- package/dist/hooks/useShapes.d.ts +16 -12
- package/dist/react-paint.css +1 -1
- package/dist/react-paint.js +5374 -5596
- package/dist/react-paint.umd.cjs +17 -43
- package/dist/types/Mode.d.ts +4 -4
- package/dist/types/Shapes.d.ts +83 -67
- package/dist/types/react.d.ts +7 -0
- package/dist/types/tools.d.ts +2 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/utils/data.d.ts +2 -223
- package/dist/utils/file.d.ts +2 -2
- package/dist/utils/{shapes/grid.d.ts → grid.d.ts} +2 -2
- package/dist/utils/migration.d.ts +98 -116
- package/dist/utils/selection/lineSelection.d.ts +12 -0
- package/dist/utils/selection/rectSelection.d.ts +13 -0
- package/dist/utils/selection.d.ts +4 -4
- package/dist/utils/shapes/brush.d.ts +10 -45
- package/dist/utils/shapes/circle.d.ts +10 -6
- package/dist/utils/shapes/curve.d.ts +10 -5
- package/dist/utils/shapes/ellipse.d.ts +10 -6
- package/dist/utils/shapes/index.d.ts +11 -227
- package/dist/utils/shapes/line.d.ts +10 -16
- package/dist/utils/shapes/path.d.ts +9 -0
- package/dist/utils/shapes/picture.d.ts +11 -5
- package/dist/utils/shapes/polygon.d.ts +11 -5
- package/dist/utils/shapes/rectangle.d.ts +11 -17
- package/dist/utils/shapes/text.d.ts +8 -37
- package/dist/utils/shapes/triangle.d.ts +3 -2
- package/dist/utils/style.d.ts +1 -1
- package/dist/utils/transform.d.ts +5 -4
- package/dist/utils/trigo.d.ts +7 -1
- package/package.json +15 -15
- package/dist/utils/shapes/default.d.ts +0 -10
|
@@ -1,245 +1,29 @@
|
|
|
1
|
-
import type { Point, DrawableShape, Rect } from '../../types/Shapes';
|
|
1
|
+
import type { Point, DrawableShape, Rect, ShapeEntity } from '../../types/Shapes';
|
|
2
2
|
import type { CustomTool } from '../../types/tools';
|
|
3
3
|
import type { GridFormatType } from '../../constants/app';
|
|
4
4
|
import { SelectionModeData } from '../../types/Mode';
|
|
5
|
-
export declare const createShape: (ctx: CanvasRenderingContext2D, shape: CustomTool,
|
|
5
|
+
export declare const createShape: (ctx: CanvasRenderingContext2D, shape: Exclude<CustomTool, {
|
|
6
|
+
type: 'picture';
|
|
7
|
+
}>, cursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
6
8
|
export declare const drawShape: (ctx: CanvasRenderingContext2D, shape: DrawableShape, responsiveScale: number, canvasOffset: Point, selectionPadding: number) => void;
|
|
7
9
|
export declare const getShapeInfos: (shape: DrawableShape, selectionPadding: number) => {
|
|
8
10
|
borders: Rect;
|
|
9
11
|
center: Point;
|
|
10
12
|
};
|
|
11
|
-
export declare const rotateShape: (shape:
|
|
13
|
+
export declare const rotateShape: <T extends DrawableShape>(shape: T, cursorPosition: Point, originalShape: T, originalCursorPosition: Point, shapeCenter: Point, gridFormat: GridFormatType) => T & {
|
|
12
14
|
rotation: number;
|
|
13
|
-
visible?: boolean | undefined;
|
|
14
|
-
locked?: boolean | undefined;
|
|
15
|
-
style?: {
|
|
16
|
-
fillColor?: string | undefined;
|
|
17
|
-
globalAlpha?: number | undefined;
|
|
18
|
-
strokeColor?: string | undefined;
|
|
19
|
-
lineWidth?: number | undefined;
|
|
20
|
-
lineDash?: number | undefined;
|
|
21
|
-
lineArrow?: number | undefined;
|
|
22
|
-
pointsCount?: number | undefined;
|
|
23
|
-
fontFamily?: string | undefined;
|
|
24
|
-
fontItalic?: boolean | undefined;
|
|
25
|
-
fontBold?: boolean | undefined;
|
|
26
|
-
} | undefined;
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
id: string;
|
|
32
|
-
toolId?: string | undefined;
|
|
33
|
-
type: "rect";
|
|
34
|
-
} | {
|
|
35
|
-
rotation: number;
|
|
36
|
-
visible?: boolean | undefined;
|
|
37
|
-
locked?: boolean | undefined;
|
|
38
|
-
style?: {
|
|
39
|
-
fillColor?: string | undefined;
|
|
40
|
-
globalAlpha?: number | undefined;
|
|
41
|
-
strokeColor?: string | undefined;
|
|
42
|
-
lineWidth?: number | undefined;
|
|
43
|
-
lineDash?: number | undefined;
|
|
44
|
-
lineArrow?: number | undefined;
|
|
45
|
-
pointsCount?: number | undefined;
|
|
46
|
-
fontFamily?: string | undefined;
|
|
47
|
-
fontItalic?: boolean | undefined;
|
|
48
|
-
fontBold?: boolean | undefined;
|
|
49
|
-
} | undefined;
|
|
50
|
-
x: number;
|
|
51
|
-
y: number;
|
|
52
|
-
width: number;
|
|
53
|
-
height: number;
|
|
54
|
-
id: string;
|
|
55
|
-
toolId?: string | undefined;
|
|
56
|
-
type: "square";
|
|
57
|
-
} | {
|
|
58
|
-
rotation: number;
|
|
59
|
-
visible?: boolean | undefined;
|
|
60
|
-
locked?: boolean | undefined;
|
|
61
|
-
style?: {
|
|
62
|
-
fillColor?: string | undefined;
|
|
63
|
-
globalAlpha?: number | undefined;
|
|
64
|
-
strokeColor?: string | undefined;
|
|
65
|
-
lineWidth?: number | undefined;
|
|
66
|
-
lineDash?: number | undefined;
|
|
67
|
-
lineArrow?: number | undefined;
|
|
68
|
-
pointsCount?: number | undefined;
|
|
69
|
-
fontFamily?: string | undefined;
|
|
70
|
-
fontItalic?: boolean | undefined;
|
|
71
|
-
fontBold?: boolean | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
x: number;
|
|
74
|
-
y: number;
|
|
75
|
-
width: number;
|
|
76
|
-
height: number;
|
|
77
|
-
src: string;
|
|
78
|
-
img: HTMLImageElement;
|
|
79
|
-
id: string;
|
|
80
|
-
toolId?: string | undefined;
|
|
81
|
-
type: "picture";
|
|
82
|
-
} | {
|
|
83
|
-
rotation: number;
|
|
84
|
-
visible?: boolean | undefined;
|
|
85
|
-
locked?: boolean | undefined;
|
|
86
|
-
style?: {
|
|
87
|
-
fillColor?: string | undefined;
|
|
88
|
-
globalAlpha?: number | undefined;
|
|
89
|
-
strokeColor?: string | undefined;
|
|
90
|
-
lineWidth?: number | undefined;
|
|
91
|
-
lineDash?: number | undefined;
|
|
92
|
-
lineArrow?: number | undefined;
|
|
93
|
-
pointsCount?: number | undefined;
|
|
94
|
-
fontFamily?: string | undefined;
|
|
95
|
-
fontItalic?: boolean | undefined;
|
|
96
|
-
fontBold?: boolean | undefined;
|
|
97
|
-
} | undefined;
|
|
98
|
-
x: number;
|
|
99
|
-
y: number;
|
|
100
|
-
width: number;
|
|
101
|
-
height: number;
|
|
102
|
-
value: string[];
|
|
103
|
-
fontSize: number;
|
|
104
|
-
id: string;
|
|
105
|
-
toolId?: string | undefined;
|
|
106
|
-
type: "text";
|
|
107
|
-
} | {
|
|
108
|
-
rotation: number;
|
|
109
|
-
visible?: boolean | undefined;
|
|
110
|
-
locked?: boolean | undefined;
|
|
111
|
-
style?: {
|
|
112
|
-
fillColor?: string | undefined;
|
|
113
|
-
globalAlpha?: number | undefined;
|
|
114
|
-
strokeColor?: string | undefined;
|
|
115
|
-
lineWidth?: number | undefined;
|
|
116
|
-
lineDash?: number | undefined;
|
|
117
|
-
lineArrow?: number | undefined;
|
|
118
|
-
pointsCount?: number | undefined;
|
|
119
|
-
fontFamily?: string | undefined;
|
|
120
|
-
fontItalic?: boolean | undefined;
|
|
121
|
-
fontBold?: boolean | undefined;
|
|
122
|
-
} | undefined;
|
|
123
|
-
points: [Point, Point];
|
|
124
|
-
id: string;
|
|
125
|
-
toolId?: string | undefined;
|
|
126
|
-
type: "line";
|
|
127
|
-
} | {
|
|
128
|
-
rotation: number;
|
|
129
|
-
visible?: boolean | undefined;
|
|
130
|
-
locked?: boolean | undefined;
|
|
131
|
-
style?: {
|
|
132
|
-
fillColor?: string | undefined;
|
|
133
|
-
globalAlpha?: number | undefined;
|
|
134
|
-
strokeColor?: string | undefined;
|
|
135
|
-
lineWidth?: number | undefined;
|
|
136
|
-
lineDash?: number | undefined;
|
|
137
|
-
lineArrow?: number | undefined;
|
|
138
|
-
pointsCount?: number | undefined;
|
|
139
|
-
fontFamily?: string | undefined;
|
|
140
|
-
fontItalic?: boolean | undefined;
|
|
141
|
-
fontBold?: boolean | undefined;
|
|
142
|
-
} | undefined;
|
|
143
|
-
points: Point[];
|
|
144
|
-
id: string;
|
|
145
|
-
toolId?: string | undefined;
|
|
146
|
-
type: "polygon";
|
|
147
|
-
} | {
|
|
148
|
-
rotation: number;
|
|
149
|
-
visible?: boolean | undefined;
|
|
150
|
-
locked?: boolean | undefined;
|
|
151
|
-
style?: {
|
|
152
|
-
fillColor?: string | undefined;
|
|
153
|
-
globalAlpha?: number | undefined;
|
|
154
|
-
strokeColor?: string | undefined;
|
|
155
|
-
lineWidth?: number | undefined;
|
|
156
|
-
lineDash?: number | undefined;
|
|
157
|
-
lineArrow?: number | undefined;
|
|
158
|
-
pointsCount?: number | undefined;
|
|
159
|
-
fontFamily?: string | undefined;
|
|
160
|
-
fontItalic?: boolean | undefined;
|
|
161
|
-
fontBold?: boolean | undefined;
|
|
162
|
-
} | undefined;
|
|
163
|
-
points: Point[];
|
|
164
|
-
id: string;
|
|
165
|
-
toolId?: string | undefined;
|
|
166
|
-
type: "curve";
|
|
167
|
-
} | {
|
|
168
|
-
rotation: number;
|
|
169
|
-
visible?: boolean | undefined;
|
|
170
|
-
locked?: boolean | undefined;
|
|
171
|
-
style?: {
|
|
172
|
-
fillColor?: string | undefined;
|
|
173
|
-
globalAlpha?: number | undefined;
|
|
174
|
-
strokeColor?: string | undefined;
|
|
175
|
-
lineWidth?: number | undefined;
|
|
176
|
-
lineDash?: number | undefined;
|
|
177
|
-
lineArrow?: number | undefined;
|
|
178
|
-
pointsCount?: number | undefined;
|
|
179
|
-
fontFamily?: string | undefined;
|
|
180
|
-
fontItalic?: boolean | undefined;
|
|
181
|
-
fontBold?: boolean | undefined;
|
|
182
|
-
} | undefined;
|
|
183
|
-
points: Point[][];
|
|
184
|
-
id: string;
|
|
185
|
-
toolId?: string | undefined;
|
|
186
|
-
type: "brush";
|
|
187
|
-
} | {
|
|
188
|
-
rotation: number;
|
|
189
|
-
visible?: boolean | undefined;
|
|
190
|
-
locked?: boolean | undefined;
|
|
191
|
-
style?: {
|
|
192
|
-
fillColor?: string | undefined;
|
|
193
|
-
globalAlpha?: number | undefined;
|
|
194
|
-
strokeColor?: string | undefined;
|
|
195
|
-
lineWidth?: number | undefined;
|
|
196
|
-
lineDash?: number | undefined;
|
|
197
|
-
lineArrow?: number | undefined;
|
|
198
|
-
pointsCount?: number | undefined;
|
|
199
|
-
fontFamily?: string | undefined;
|
|
200
|
-
fontItalic?: boolean | undefined;
|
|
201
|
-
fontBold?: boolean | undefined;
|
|
202
|
-
} | undefined;
|
|
203
|
-
x: number;
|
|
204
|
-
y: number;
|
|
205
|
-
radius: number;
|
|
206
|
-
id: string;
|
|
207
|
-
toolId?: string | undefined;
|
|
208
|
-
type: "circle";
|
|
209
|
-
} | {
|
|
210
|
-
rotation: number;
|
|
211
|
-
visible?: boolean | undefined;
|
|
212
|
-
locked?: boolean | undefined;
|
|
213
|
-
style?: {
|
|
214
|
-
fillColor?: string | undefined;
|
|
215
|
-
globalAlpha?: number | undefined;
|
|
216
|
-
strokeColor?: string | undefined;
|
|
217
|
-
lineWidth?: number | undefined;
|
|
218
|
-
lineDash?: number | undefined;
|
|
219
|
-
lineArrow?: number | undefined;
|
|
220
|
-
pointsCount?: number | undefined;
|
|
221
|
-
fontFamily?: string | undefined;
|
|
222
|
-
fontItalic?: boolean | undefined;
|
|
223
|
-
fontBold?: boolean | undefined;
|
|
224
|
-
} | undefined;
|
|
225
|
-
x: number;
|
|
226
|
-
y: number;
|
|
227
|
-
radiusX: number;
|
|
228
|
-
radiusY: number;
|
|
229
|
-
id: string;
|
|
230
|
-
toolId?: string | undefined;
|
|
231
|
-
type: "ellipse";
|
|
232
15
|
};
|
|
233
|
-
export declare const resizeShape: (ctx: CanvasRenderingContext2D, shape:
|
|
234
|
-
export declare const translateShape: (cursorPosition: Point, originalShape:
|
|
235
|
-
export declare const
|
|
16
|
+
export declare const resizeShape: <T extends DrawableShape>(ctx: CanvasRenderingContext2D, shape: T, cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeData<Point | number>, gridFormat: GridFormatType, selectionPadding: number, isShiftPressed: boolean, currentScale: number) => T;
|
|
17
|
+
export declare const translateShape: (cursorPosition: Point, originalShape: ShapeEntity, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
18
|
+
export declare const refreshShape: (shape: ShapeEntity, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
19
|
+
export declare const drawShapeSelection: ({ ctx, shape, currentScale, canvasOffset, selectionPadding, selectionWidth, selectionColor, withAnchors }: {
|
|
236
20
|
ctx: CanvasRenderingContext2D;
|
|
237
21
|
shape: DrawableShape;
|
|
238
|
-
|
|
22
|
+
currentScale: number;
|
|
239
23
|
canvasOffset: Point;
|
|
240
24
|
selectionPadding: number;
|
|
241
25
|
selectionWidth: number;
|
|
242
26
|
selectionColor: string;
|
|
243
27
|
withAnchors?: boolean | undefined;
|
|
244
28
|
}) => void;
|
|
245
|
-
export declare const copyShape: (shape:
|
|
29
|
+
export declare const copyShape: (shape: ShapeEntity, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => ShapeEntity;
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
1
2
|
import { SelectionModeResize } from '../../types/Mode';
|
|
2
|
-
import type { Point,
|
|
3
|
+
import type { Point, DrawableShape, Line, Triangle, ShapeEntity, Rect, StyleShape } from '../../types/Shapes';
|
|
3
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshLine: <T extends DrawableShape<"line">>(line: T, currentScale: number, selectionPadding: number) => T;
|
|
4
6
|
export declare const createLine: (shape: {
|
|
5
7
|
id: string;
|
|
6
|
-
icon: string;
|
|
7
|
-
label: string;
|
|
8
8
|
type: 'line';
|
|
9
9
|
settings: ToolsSettingsType<'line'>;
|
|
10
|
-
}, cursorPosition: Point) =>
|
|
11
|
-
export declare const buildTriangleOnLine: (center: Point, rotation: number, lineStyle:
|
|
12
|
-
export declare const drawLine: (ctx: CanvasRenderingContext2D,
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'line'>;
|
|
11
|
+
export declare const buildTriangleOnLine: (center: Point, rotation: number, lineStyle: StyleShape) => Triangle;
|
|
12
|
+
export declare const drawLine: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'line'>) => void;
|
|
13
13
|
export declare const getLineBorder: (line: Line, selectionPadding: number) => Rect;
|
|
14
|
-
export declare const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
withAnchors: boolean;
|
|
19
|
-
selectionPadding: number;
|
|
20
|
-
selectionWidth: number;
|
|
21
|
-
selectionColor: string;
|
|
22
|
-
currentScale?: number | undefined;
|
|
23
|
-
}) => void;
|
|
14
|
+
export declare const translateLine: <U extends DrawableShape<"line">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
|
+
points: [Point, Point];
|
|
16
|
+
};
|
|
17
|
+
export declare const resizeLine: <U extends DrawableShape<"line">>(cursorPosition: Point, canvasOffset: Point, originalShape: U, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => U;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Circle, DrawableShape, Line, Rect } from "../../types/Shapes";
|
|
2
|
+
export declare const createRecPath: (rect: Rect) => Path2D;
|
|
3
|
+
export declare const createCirclePath: (shape: Circle) => Path2D;
|
|
4
|
+
export declare const createEllipsePath: (ellipse: DrawableShape<'ellipse'>) => Path2D;
|
|
5
|
+
export declare const createLinePath: (line: Line) => Path2D;
|
|
6
|
+
export declare const createBrushPath: (brush: DrawableShape<'brush'>, selectionPadding: number) => Path2D | undefined;
|
|
7
|
+
export declare const createCurvePath: (curve: DrawableShape<'curve'>) => Path2D | undefined;
|
|
8
|
+
export declare const createPolygonPath: (polygon: DrawableShape<'polygon'>) => Path2D | undefined;
|
|
9
|
+
export declare const createTrianglePath: (triangle: DrawableShape<'triangle'>) => Path2D;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DrawableShape, Picture, Point, Rect, ShapeEntity } from '../../types/Shapes';
|
|
2
2
|
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
3
|
+
import { GridFormatType } from '../../constants/app';
|
|
4
|
+
export declare const refreshPicture: <T extends DrawableShape<"picture">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
5
|
+
export declare const createPicture: (fileOrUrl: File | string, maxPictureWidth: number, maxPictureHeight: number, currentScale: number, selectionPadding: number) => Promise<ShapeEntity<"picture">>;
|
|
6
|
+
export declare const drawPicture: (ctx: CanvasRenderingContext2D, picture: DrawableShape<'picture'>) => void;
|
|
7
|
+
export declare const getPictureBorder: (picture: Picture, selectionPadding: number) => Rect;
|
|
8
|
+
export declare const translatePicture: <U extends DrawableShape<"picture">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const resizePicture: (cursorPosition: Point, originalShape: DrawableShape<'picture'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'picture'>;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
2
|
+
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
+
import type { Point, DrawableShape, Polygon, Rect, ShapeEntity } from '../../types/Shapes';
|
|
2
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshPolygon: <T extends DrawableShape<"polygon">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
3
6
|
export declare const createPolygon: (shape: {
|
|
4
7
|
id: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
label: string;
|
|
7
8
|
type: 'polygon';
|
|
8
9
|
settings: ToolsSettingsType<'polygon'>;
|
|
9
|
-
}, cursorPosition: Point) =>
|
|
10
|
-
export declare const drawPolygon: (ctx: CanvasRenderingContext2D, polygon:
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'polygon'>;
|
|
11
|
+
export declare const drawPolygon: (ctx: CanvasRenderingContext2D, polygon: DrawableShape<'polygon'>) => void;
|
|
11
12
|
export declare const getPolygonBorder: (polygon: Polygon, selectionPadding: number) => Rect;
|
|
13
|
+
export declare const translatePolygon: <U extends DrawableShape<"polygon">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
+
points: Point[];
|
|
15
|
+
};
|
|
16
|
+
export declare const resizePolygon: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'polygon'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'polygon'>;
|
|
17
|
+
export declare const updatePolygonLinesCount: <T extends DrawableShape<"polygon">>(shape: T, newPointsCount: number, currentScale: number, selectionPadding: number) => T;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import type { GridFormatType } from '../../constants/app';
|
|
2
|
+
import type { SelectionModeResize } from '../../types/Mode';
|
|
3
|
+
import type { Point, DrawableShape, ShapeEntity, Rect } from '../../types/Shapes';
|
|
3
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
4
|
-
type
|
|
5
|
+
type rectish = 'text' | 'rect' | 'square' | 'picture';
|
|
6
|
+
export declare const refreshRect: <T extends DrawableShape<rectish>>(rect: T, currentScale: number, selectionPadding: number) => T;
|
|
5
7
|
export declare const createRectangle: <T extends "rect" | "square">(shape: {
|
|
6
8
|
id: string;
|
|
7
|
-
icon: string;
|
|
8
|
-
label: string;
|
|
9
9
|
type: T;
|
|
10
10
|
settings: ToolsSettingsType<T>;
|
|
11
|
-
}, cursorPosition: Point) =>
|
|
12
|
-
export declare const drawRect: (ctx: CanvasRenderingContext2D,
|
|
11
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<T>;
|
|
12
|
+
export declare const drawRect: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'rect' | 'square'>) => void;
|
|
13
13
|
export declare const getRectBorder: (rect: Rect, selectionPadding: number) => Rect;
|
|
14
|
-
export declare const getRectOppositeAnchorAbsolutePosition: <T extends DrawableShape &
|
|
14
|
+
export declare const getRectOppositeAnchorAbsolutePosition: <T extends DrawableShape & Rect>(anchor: Point, center: Point, shape: T, canvasOffset: Point, [negW, negH]?: [boolean, boolean]) => Point;
|
|
15
|
+
export declare const translateRect: <T extends "rect" | "square", U extends DrawableShape<T>>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
16
|
x: number;
|
|
16
17
|
y: number;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}>(anchor: Point, center: Point, shape: T, canvasOffset: Point, [negW, negH]?: [boolean, boolean]) => Point;
|
|
20
|
-
export declare const resizeRect: <T extends DrawableShape & import("../../types/Shapes").StyledShape & {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
}>(cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeResize, selectionPadding: number, keepRatio?: boolean) => T;
|
|
18
|
+
};
|
|
19
|
+
export declare const resizeRect: <T extends rectish>(cursorPosition: Point, originalShape: DrawableShape<T>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<T>;
|
|
26
20
|
export {};
|
|
@@ -1,48 +1,19 @@
|
|
|
1
|
-
import type { Point,
|
|
1
|
+
import type { Point, DrawableShape, Text, Rect, ShapeEntity } from '../../types/Shapes';
|
|
2
2
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
3
3
|
import { SelectionModeResize } from '../../types/Mode';
|
|
4
|
+
import { GridFormatType } from '../../constants/app';
|
|
5
|
+
export declare const refreshText: <T extends DrawableShape<"text">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
4
6
|
export declare const calculateTextFontSize: (ctx: CanvasRenderingContext2D, text: string[], maxWidth: number, fontBold: boolean, fontItalic: boolean, fontFamily?: string | undefined) => number;
|
|
5
7
|
export declare const createText: (ctx: CanvasRenderingContext2D, shape: {
|
|
6
8
|
id: string;
|
|
7
|
-
icon: string;
|
|
8
|
-
label: string;
|
|
9
9
|
type: 'text';
|
|
10
10
|
settings: ToolsSettingsType<'text'>;
|
|
11
|
-
}, cursorPosition: Point) =>
|
|
12
|
-
export declare const drawText: (ctx: CanvasRenderingContext2D, text:
|
|
11
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'text'>;
|
|
12
|
+
export declare const drawText: (ctx: CanvasRenderingContext2D, text: DrawableShape<'text'>) => void;
|
|
13
13
|
export declare const getTextBorder: (text: Text, selectionPadding: number) => Rect;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const translateText: <U extends DrawableShape<"text">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
15
|
x: number;
|
|
16
16
|
y: number;
|
|
17
|
-
width: number;
|
|
18
|
-
height: number;
|
|
19
|
-
} & {
|
|
20
|
-
value: string[];
|
|
21
|
-
fontSize: number;
|
|
22
|
-
}>(ctx: CanvasRenderingContext2D, cursorPosition: Point, canvasOffset: Point, originalShape: T, selectionMode: SelectionModeResize, selectionPadding: number) => T;
|
|
23
|
-
export declare const resizeTextShapeWithNewContent: (ctx: CanvasRenderingContext2D, shape: DrawableText, newValue: string[], canvasOffset: Point) => {
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
width: number;
|
|
27
|
-
height: number;
|
|
28
|
-
visible?: boolean | undefined;
|
|
29
|
-
locked?: boolean | undefined;
|
|
30
|
-
style?: {
|
|
31
|
-
fillColor?: string | undefined;
|
|
32
|
-
globalAlpha?: number | undefined;
|
|
33
|
-
strokeColor?: string | undefined;
|
|
34
|
-
lineWidth?: number | undefined;
|
|
35
|
-
lineDash?: number | undefined;
|
|
36
|
-
lineArrow?: number | undefined;
|
|
37
|
-
pointsCount?: number | undefined;
|
|
38
|
-
fontFamily?: string | undefined;
|
|
39
|
-
fontItalic?: boolean | undefined;
|
|
40
|
-
fontBold?: boolean | undefined;
|
|
41
|
-
} | undefined;
|
|
42
|
-
value: string[];
|
|
43
|
-
fontSize: number;
|
|
44
|
-
id: string;
|
|
45
|
-
toolId?: string | undefined;
|
|
46
|
-
rotation: number;
|
|
47
|
-
type: "text";
|
|
48
17
|
};
|
|
18
|
+
export declare const resizeText: (ctx: CanvasRenderingContext2D, cursorPosition: Point, originalShape: DrawableShape<'text'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'text'>;
|
|
19
|
+
export declare const resizeTextShapeWithNewContent: <U extends DrawableShape<"text">>(ctx: CanvasRenderingContext2D, shape: U, newValue: string[], selectionPadding: number, canvasOffset: Point) => U;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { Triangle } from '../../types/Shapes';
|
|
2
|
-
export declare const
|
|
1
|
+
import { DrawableShape, Triangle } from '../../types/Shapes';
|
|
2
|
+
export declare const createTriangle: (triangle: Triangle) => DrawableShape<'triangle'>;
|
|
3
|
+
export declare const drawTriangle: (ctx: CanvasRenderingContext2D, triangle: DrawableShape<'triangle'>) => void;
|
package/dist/utils/style.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ShapeType } from '../types/Shapes';
|
|
2
|
-
export declare const getShapePicture: (shape: ShapeType) => "<svg><path d=\"M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z\"/></svg>" | "<svg><path d=\"M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z\"/></svg>" | "<svg><path d=\"M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z\"/></svg>" | "<svg><path d=\"M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z\"/></svg>" | "<svg><path d=\"M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z\"/></svg>" | "<svg><path d=\"M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z\"/></svg>" | "<svg><path d=\"M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z\"/></svg>" | "<svg><path d=\"M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z\"/></svg>";
|
|
2
|
+
export declare const getShapePicture: (shape: ShapeType) => "" | "<svg><path d=\"M5.146 17.5Q4.146 17.5 3.208 17Q2.271 16.5 1.667 15.708Q2.208 15.75 2.802 15.344Q3.396 14.938 3.396 14.104Q3.396 13.042 4.135 12.292Q4.875 11.542 5.958 11.542Q7.021 11.542 7.76 12.292Q8.5 13.042 8.5 14.104Q8.5 15.5 7.51 16.5Q6.521 17.5 5.146 17.5ZM9.917 12.5 7.562 10.146 14.917 2.729Q15.146 2.5 15.469 2.5Q15.792 2.5 16.021 2.729L17.271 3.958Q17.5 4.188 17.5 4.531Q17.5 4.875 17.271 5.125Z\"/></svg>" | "<svg><path d=\"M2.5 17.5V2.5H17.5V17.5ZM4.25 15.75H15.75V4.25H4.25ZM4.25 15.75V4.25V15.75Z\"/></svg>" | "<svg><path d=\"M10 18.333Q8.271 18.333 6.75 17.677Q5.229 17.021 4.104 15.896Q2.979 14.771 2.323 13.25Q1.667 11.729 1.667 10Q1.667 8.271 2.323 6.75Q2.979 5.229 4.104 4.104Q5.229 2.979 6.75 2.323Q8.271 1.667 10 1.667Q11.729 1.667 13.25 2.323Q14.771 2.979 15.896 4.104Q17.021 5.229 17.677 6.75Q18.333 8.271 18.333 10Q18.333 11.729 17.677 13.25Q17.021 14.771 15.896 15.896Q14.771 17.021 13.25 17.677Q11.729 18.333 10 18.333ZM10 16.583Q12.75 16.583 14.667 14.667Q16.583 12.75 16.583 10Q16.583 7.25 14.667 5.333Q12.75 3.417 10 3.417Q7.25 3.417 5.333 5.333Q3.417 7.25 3.417 10Q3.417 12.75 5.333 14.667Q7.25 16.583 10 16.583ZM10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Q10 10 10 10Z\"/></svg>" | "<svg><path d=\"M12.25 18.333V16.167L6.833 13.458H2.5V8.208H6.25L8.25 5.917V1.667H13.5V6.917H9.708L7.75 9.146V11.958L12.25 14.208V13.083H17.5V18.333Z\"/></svg>" | "<svg><path d=\"M4.792 15.083 8.333 11.542 9.833 13.021 11.667 10.708 15.167 15.083ZM6.667 8.417Q5.938 8.417 5.427 7.906Q4.917 7.396 4.917 6.667Q4.917 5.938 5.427 5.427Q5.938 4.917 6.667 4.917Q7.396 4.917 7.906 5.427Q8.417 5.938 8.417 6.667Q8.417 7.396 7.906 7.906Q7.396 8.417 6.667 8.417ZM4.167 18.333Q3.125 18.333 2.396 17.604Q1.667 16.875 1.667 15.833V4.167Q1.667 3.125 2.396 2.396Q3.125 1.667 4.167 1.667H15.833Q16.875 1.667 17.604 2.396Q18.333 3.125 18.333 4.167V15.833Q18.333 16.875 17.604 17.604Q16.875 18.333 15.833 18.333ZM4.167 16.583H15.833Q16.146 16.583 16.365 16.365Q16.583 16.146 16.583 15.833V4.167Q16.583 3.854 16.365 3.635Q16.146 3.417 15.833 3.417H4.167Q3.854 3.417 3.635 3.635Q3.417 3.854 3.417 4.167V15.833Q3.417 16.146 3.635 16.365Q3.854 16.583 4.167 16.583Z\"/></svg>" | "<svg><path d=\"M8.708 16.667V5.917H4.167V3.333H15.833V5.917H11.292V16.667Z\"/></svg>" | "<svg><path d=\"M7.5 15.833V14.083H12.833L3.333 4.583L4.583 3.333L14.083 12.833V7.5H15.833V15.833Z\"/></svg>" | "<svg><path d=\"M7.521 17.5Q6.125 17.5 5.146 16.51Q4.167 15.521 4.167 14.125V7.417Q3.438 7.125 2.969 6.49Q2.5 5.854 2.5 5.042Q2.5 3.979 3.24 3.24Q3.979 2.5 5.042 2.5Q6.104 2.5 6.844 3.24Q7.583 3.979 7.583 5.042Q7.583 5.854 7.115 6.49Q6.646 7.125 5.917 7.417V14.125Q5.917 14.792 6.385 15.271Q6.854 15.75 7.521 15.75Q8.188 15.75 8.656 15.271Q9.125 14.792 9.125 14.125V5.875Q9.125 4.479 10.104 3.49Q11.083 2.5 12.479 2.5Q13.875 2.5 14.854 3.49Q15.833 4.479 15.833 5.875V12.583Q16.562 12.875 17.031 13.51Q17.5 14.146 17.5 14.958Q17.5 16.021 16.76 16.76Q16.021 17.5 14.958 17.5Q13.896 17.5 13.156 16.76Q12.417 16.021 12.417 14.958Q12.417 14.146 12.885 13.5Q13.354 12.854 14.083 12.583V5.875Q14.083 5.208 13.615 4.729Q13.146 4.25 12.479 4.25Q11.812 4.25 11.344 4.729Q10.875 5.208 10.875 5.875V14.125Q10.875 15.521 9.896 16.51Q8.917 17.5 7.521 17.5Z\"/></svg>";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { SelectionModeData } from '../types/Mode';
|
|
2
|
-
import type { Point,
|
|
2
|
+
import type { Point, ShapeEntity } from '../types/Shapes';
|
|
3
3
|
import type { GridFormatType } from '../constants/app';
|
|
4
4
|
export declare const getNormalizedSize: (originalWidth: number, originalHeight: number, width: number, height: number) => number[];
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
5
|
+
export declare const roundValues: (prop: number, precision?: number) => number;
|
|
6
|
+
export declare const roundForGrid: (value: number, gridFormat: GridFormatType, gridOffset?: number) => number;
|
|
7
|
+
export declare const roundRotationForGrid: (rotation: number, gridFormat: GridFormatType, gridOffset?: number) => number;
|
|
8
|
+
export declare const transformShape: (ctx: CanvasRenderingContext2D, shape: ShapeEntity, cursorPosition: Point, gridFormat: GridFormatType, canvasOffset: Point, selectionMode: SelectionModeData<Point | number>, selectionPadding: number, isShiftPressed: boolean, currentScale: number) => ShapeEntity;
|
|
8
9
|
export declare const fitContentInsideContainer: (contentWidth: number, contentHeight: number, containerWidth: number, containerHeight: number, shouldFillContainer?: boolean) => number[];
|
package/dist/utils/trigo.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Point, Rect } from '../types/Shapes';
|
|
2
|
+
type Vector = [Point, Point];
|
|
2
3
|
export declare const degreesToRadians: (degrees: number) => number;
|
|
3
4
|
export declare const radiansToDegrees: (radians: number) => number;
|
|
4
5
|
export declare const isPointInsideRect: (rect: Rect, point: Point) => boolean;
|
|
@@ -7,4 +8,9 @@ export declare const rotatePoint: ({ origin, point, rotation }: {
|
|
|
7
8
|
point: Point;
|
|
8
9
|
rotation: number;
|
|
9
10
|
}) => Point;
|
|
10
|
-
export declare const getAngleFromVector: (
|
|
11
|
+
export declare const getAngleFromVector: ({ targetVector: [point1, point2], radian, originVector }: {
|
|
12
|
+
targetVector: Vector;
|
|
13
|
+
radian?: boolean | undefined;
|
|
14
|
+
originVector?: Vector | undefined;
|
|
15
|
+
}) => number;
|
|
16
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yorab/react-paint",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Yohann Rabatel",
|
|
@@ -26,35 +26,35 @@
|
|
|
26
26
|
"lodash": "4.17.21"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@storybook/addon-essentials": "7.
|
|
30
|
-
"@storybook/addon-interactions": "7.
|
|
31
|
-
"@storybook/addon-links": "7.
|
|
32
|
-
"@storybook/
|
|
33
|
-
"@storybook/
|
|
34
|
-
"@storybook/react": "7.
|
|
35
|
-
"@storybook/
|
|
36
|
-
"@storybook/testing-library": "0.2.
|
|
29
|
+
"@storybook/addon-essentials": "7.6.3",
|
|
30
|
+
"@storybook/addon-interactions": "7.6.3",
|
|
31
|
+
"@storybook/addon-links": "7.6.3",
|
|
32
|
+
"@storybook/blocks": "7.6.3",
|
|
33
|
+
"@storybook/react": "7.6.3",
|
|
34
|
+
"@storybook/react-vite": "7.6.3",
|
|
35
|
+
"@storybook/test": "^7.6.3",
|
|
36
|
+
"@storybook/testing-library": "0.2.2",
|
|
37
37
|
"@types/lodash": "4.14.196",
|
|
38
38
|
"@types/node": "20.4.5",
|
|
39
39
|
"@types/react": "18.2.17",
|
|
40
40
|
"@types/react-dom": "18.2.7",
|
|
41
41
|
"@typescript-eslint/eslint-plugin": "6.0.0",
|
|
42
42
|
"@typescript-eslint/parser": "6.0.0",
|
|
43
|
-
"@vitejs/plugin-react": "4.0
|
|
43
|
+
"@vitejs/plugin-react": "4.2.0",
|
|
44
44
|
"eslint": "8.45.0",
|
|
45
45
|
"eslint-config-prettier": "8.9.0",
|
|
46
46
|
"eslint-import-resolver-typescript": "3.5.5",
|
|
47
47
|
"eslint-plugin-import": "2.28.0",
|
|
48
48
|
"eslint-plugin-prettier": "5.0.0",
|
|
49
49
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
50
|
-
"eslint-plugin-storybook": "0.6.
|
|
50
|
+
"eslint-plugin-storybook": "0.6.15",
|
|
51
51
|
"lightningcss": "1.21.5",
|
|
52
52
|
"prettier": "3.0.0",
|
|
53
53
|
"react": "18.2.0",
|
|
54
54
|
"react-dom": "18.2.0",
|
|
55
|
-
"storybook": "7.
|
|
56
|
-
"typescript": "5.
|
|
57
|
-
"vite": "
|
|
55
|
+
"storybook": "7.6.3",
|
|
56
|
+
"typescript": "5.3.2",
|
|
57
|
+
"vite": "5.0.2",
|
|
58
58
|
"vite-tsconfig-paths": "4.2.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"react-dom": "18.x"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
|
-
"declarationfiles": "tsc --project tsconfig.prod.json",
|
|
65
|
+
"declarationfiles": "npx tsc --project tsconfig.prod.json",
|
|
66
66
|
"start": "storybook dev -p 6006",
|
|
67
67
|
"build-storybook": "storybook build",
|
|
68
68
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { DrawableShape } from '../../types/Shapes';
|
|
2
|
-
export declare const drawSelectionDefault: ({ ctx, shape, withAnchors, selectionPadding, selectionWidth, selectionColor, currentScale }: {
|
|
3
|
-
ctx: CanvasRenderingContext2D;
|
|
4
|
-
shape: DrawableShape;
|
|
5
|
-
withAnchors: boolean;
|
|
6
|
-
selectionPadding: number;
|
|
7
|
-
selectionWidth: number;
|
|
8
|
-
selectionColor: string;
|
|
9
|
-
currentScale?: number | undefined;
|
|
10
|
-
}) => void;
|