@yorab/react-paint 0.8.0 → 0.9.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.
- 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 -5600
- 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
package/dist/types/Mode.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Point,
|
|
1
|
+
import type { Point, ShapeEntity } from './Shapes';
|
|
2
2
|
export type SelectionModeDefault = {
|
|
3
3
|
mode: 'default';
|
|
4
4
|
};
|
|
@@ -12,19 +12,19 @@ export type SelectionModeEditText = {
|
|
|
12
12
|
export type SelectionModeResize<AnchorType extends Point | number = Point> = {
|
|
13
13
|
mode: 'resize';
|
|
14
14
|
cursorStartPosition: Point;
|
|
15
|
-
originalShape:
|
|
15
|
+
originalShape: ShapeEntity;
|
|
16
16
|
anchor: AnchorType;
|
|
17
17
|
};
|
|
18
18
|
export type SelectionModeRotate = {
|
|
19
19
|
mode: 'rotate';
|
|
20
20
|
cursorStartPosition: Point;
|
|
21
|
-
originalShape:
|
|
21
|
+
originalShape: ShapeEntity;
|
|
22
22
|
center: Point;
|
|
23
23
|
};
|
|
24
24
|
export type SelectionModeTranslate = {
|
|
25
25
|
mode: 'translate';
|
|
26
26
|
cursorStartPosition: Point;
|
|
27
|
-
originalShape:
|
|
27
|
+
originalShape: ShapeEntity;
|
|
28
28
|
};
|
|
29
29
|
export type SelectionModeData<AnchorType extends Point | number> = SelectionModeDefault | SelectionModeBrush | SelectionModeResize<AnchorType> | SelectionModeRotate | SelectionModeTranslate | SelectionModeEditText;
|
|
30
30
|
export type HoverModeData = {
|
package/dist/types/Shapes.d.ts
CHANGED
|
@@ -1,107 +1,124 @@
|
|
|
1
1
|
import { ShapeTypeArray } from '../constants/shapes';
|
|
2
2
|
export type ShapeType = typeof ShapeTypeArray[number];
|
|
3
3
|
export type Point = [number, number];
|
|
4
|
-
export type
|
|
5
|
-
visible?: boolean;
|
|
6
|
-
locked?: boolean;
|
|
7
|
-
style?: {
|
|
8
|
-
fillColor?: string;
|
|
9
|
-
globalAlpha?: number;
|
|
10
|
-
strokeColor?: string;
|
|
11
|
-
lineWidth?: number;
|
|
12
|
-
lineDash?: number;
|
|
13
|
-
lineArrow?: number;
|
|
14
|
-
pointsCount?: number;
|
|
15
|
-
fontFamily?: string;
|
|
16
|
-
fontItalic?: boolean;
|
|
17
|
-
fontBold?: boolean;
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
type Drawable = {
|
|
21
|
-
id: string;
|
|
22
|
-
toolId?: string;
|
|
23
|
-
rotation: number;
|
|
24
|
-
};
|
|
25
|
-
export type Rect = StyledShape & {
|
|
4
|
+
export type Rect = {
|
|
26
5
|
x: number;
|
|
27
6
|
y: number;
|
|
28
7
|
width: number;
|
|
29
8
|
height: number;
|
|
30
9
|
};
|
|
31
|
-
export type
|
|
32
|
-
export type StoredPicture = Rect & {
|
|
10
|
+
export type Picture = Rect & {
|
|
33
11
|
src: string;
|
|
34
12
|
};
|
|
35
|
-
export type Picture = StoredPicture & {
|
|
36
|
-
img: HTMLImageElement;
|
|
37
|
-
};
|
|
38
13
|
export type Text = Rect & {
|
|
39
14
|
value: string[];
|
|
40
15
|
fontSize: number;
|
|
41
16
|
};
|
|
42
|
-
export type Line =
|
|
43
|
-
points: [Point, Point];
|
|
17
|
+
export type Line = {
|
|
18
|
+
points: readonly [Point, Point];
|
|
44
19
|
};
|
|
45
|
-
export type Triangle =
|
|
20
|
+
export type Triangle = {
|
|
46
21
|
points: [Point, Point, Point];
|
|
47
22
|
};
|
|
48
|
-
export type Polygon =
|
|
23
|
+
export type Polygon = {
|
|
49
24
|
points: Point[];
|
|
50
25
|
};
|
|
51
|
-
export type Curve =
|
|
26
|
+
export type Curve = {
|
|
52
27
|
points: Point[];
|
|
53
28
|
};
|
|
54
|
-
export type Brush =
|
|
29
|
+
export type Brush = {
|
|
55
30
|
points: Point[][];
|
|
56
31
|
};
|
|
57
|
-
export type Circle =
|
|
32
|
+
export type Circle = {
|
|
58
33
|
x: number;
|
|
59
34
|
y: number;
|
|
60
35
|
radius: number;
|
|
61
36
|
};
|
|
62
|
-
export type Ellipse =
|
|
37
|
+
export type Ellipse = {
|
|
63
38
|
x: number;
|
|
64
39
|
y: number;
|
|
65
40
|
radiusX: number;
|
|
66
41
|
radiusY: number;
|
|
67
42
|
};
|
|
68
|
-
export type
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
43
|
+
export type StyleShape = {
|
|
44
|
+
fillColor?: string;
|
|
45
|
+
globalAlpha?: number;
|
|
46
|
+
strokeColor?: string;
|
|
47
|
+
lineWidth?: number;
|
|
48
|
+
lineDash?: number;
|
|
49
|
+
lineArrow?: number;
|
|
50
|
+
pointsCount?: number;
|
|
51
|
+
fontFamily?: string;
|
|
52
|
+
fontItalic?: boolean;
|
|
53
|
+
fontBold?: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type SelectionDefaultType = {
|
|
56
|
+
border: Path2D;
|
|
57
|
+
line: Path2D;
|
|
58
|
+
anchors: Path2D[];
|
|
59
|
+
};
|
|
60
|
+
export type SelectionLinesType = {
|
|
61
|
+
border: Path2D;
|
|
62
|
+
anchors: Path2D[];
|
|
63
|
+
};
|
|
64
|
+
export type DrawableShape<T extends ShapeType = ShapeType> = {
|
|
65
|
+
visible?: boolean;
|
|
66
|
+
locked?: boolean;
|
|
67
|
+
rotation: number;
|
|
68
|
+
style?: StyleShape;
|
|
69
|
+
} & (T extends 'line' ? Line & {
|
|
70
|
+
type: 'line';
|
|
71
|
+
selection?: SelectionLinesType;
|
|
72
|
+
path?: Path2D;
|
|
73
|
+
arrows?: DrawableShape<'triangle'>[];
|
|
74
|
+
} : T extends 'picture' ? Picture & {
|
|
78
75
|
type: 'picture';
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
img: HTMLImageElement;
|
|
77
|
+
selection?: SelectionDefaultType;
|
|
78
|
+
} : T extends 'text' ? Text & {
|
|
81
79
|
type: 'text';
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
type: '
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
selection?: SelectionDefaultType;
|
|
81
|
+
} : T extends 'rect' ? Rect & {
|
|
82
|
+
type: 'rect';
|
|
83
|
+
selection?: SelectionDefaultType;
|
|
84
|
+
path?: Path2D;
|
|
85
|
+
} : T extends 'square' ? Rect & {
|
|
86
|
+
type: 'square';
|
|
87
|
+
selection?: SelectionDefaultType;
|
|
88
|
+
path?: Path2D;
|
|
89
|
+
} : T extends 'circle' ? Circle & {
|
|
90
|
+
type: 'circle';
|
|
91
|
+
selection?: SelectionDefaultType;
|
|
92
|
+
path?: Path2D;
|
|
93
|
+
} : T extends 'ellipse' ? Ellipse & {
|
|
94
|
+
type: 'ellipse';
|
|
95
|
+
selection?: SelectionDefaultType;
|
|
96
|
+
path?: Path2D;
|
|
97
|
+
} : T extends 'triangle' ? Triangle & {
|
|
98
|
+
type: 'triangle';
|
|
99
|
+
path?: Path2D;
|
|
100
|
+
} : T extends 'polygon' ? Polygon & {
|
|
87
101
|
type: 'polygon';
|
|
88
|
-
|
|
89
|
-
|
|
102
|
+
selection?: SelectionLinesType;
|
|
103
|
+
path?: Path2D;
|
|
104
|
+
} : T extends 'curve' ? Curve & {
|
|
90
105
|
type: 'curve';
|
|
91
|
-
|
|
92
|
-
|
|
106
|
+
selection?: SelectionLinesType;
|
|
107
|
+
path?: Path2D;
|
|
108
|
+
} : T extends 'brush' ? Brush & {
|
|
93
109
|
type: 'brush';
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
101
|
-
export type DrawableShape = DrawableRect | DrawableSquare | DrawablePicture | DrawableText | DrawableLine | DrawablePolygon | DrawableCurve | DrawableBrush | DrawableCircle | DrawableEllipse;
|
|
102
|
-
export type DrawableShapeJson = {
|
|
110
|
+
selection?: SelectionDefaultType;
|
|
111
|
+
path?: Path2D;
|
|
112
|
+
scaleX?: number;
|
|
113
|
+
scaleY?: number;
|
|
114
|
+
} : never);
|
|
115
|
+
export type DrawableShapeJson<T extends ShapeType = ShapeType> = DrawableShape<T> & {
|
|
103
116
|
translation?: Point;
|
|
104
|
-
}
|
|
117
|
+
};
|
|
118
|
+
export type ShapeEntity<T extends Exclude<ShapeType, 'triangle'> = Exclude<ShapeType, 'triangle'>> = {
|
|
119
|
+
id: string;
|
|
120
|
+
toolId?: string;
|
|
121
|
+
} & DrawableShape<T>;
|
|
105
122
|
export type ExportDataType = {
|
|
106
123
|
shapes: DrawableShapeJson[];
|
|
107
124
|
config?: {
|
|
@@ -109,4 +126,3 @@ export type ExportDataType = {
|
|
|
109
126
|
height: number;
|
|
110
127
|
};
|
|
111
128
|
};
|
|
112
|
-
export {};
|
package/dist/types/tools.d.ts
CHANGED
|
@@ -112,8 +112,9 @@ export type ToolsLineSettings = SettingsOpacity & SettingsStrokeColor & Settings
|
|
|
112
112
|
export type ToolsBrushSettings = SettingsOpacity & SettingsStrokeColor & SettingsLineWidth & SettingsLineDash;
|
|
113
113
|
export type ToolsPolygonSettings = SettingsOpacity & SettingsStrokeColor & SettingsFillColor & SettingsLineWidth & SettingsLineDash & SettingsPointsCount;
|
|
114
114
|
export type ToolsCurveSettings = SettingsOpacity & SettingsStrokeColor & SettingsFillColor & SettingsLineWidth & SettingsLineDash & SettingsPointsCount;
|
|
115
|
+
export type ToolsTriangleSettings = SettingsStrokeColor & SettingsFillColor & SettingsOpacity & SettingsLineWidth & SettingsLineDash;
|
|
115
116
|
export type ToolsPictureSettings = SettingsOpacity;
|
|
116
|
-
export type ToolsSettingsType<T extends ShapeType> = T extends 'rect' ? ToolsRectSettings : T extends 'square' ? ToolsSquareSettings : T extends 'circle' ? ToolsCircleSettings : T extends 'ellipse' ? ToolsEllipseSettings : T extends 'text' ? ToolsTextSettings : T extends 'line' ? ToolsLineSettings : T extends 'brush' ? ToolsBrushSettings : T extends 'polygon' ? ToolsPolygonSettings : T extends 'curve' ? ToolsCurveSettings : T extends 'picture' ? ToolsPictureSettings : unknown;
|
|
117
|
+
export type ToolsSettingsType<T extends ShapeType> = T extends 'rect' ? ToolsRectSettings : T extends 'square' ? ToolsSquareSettings : T extends 'circle' ? ToolsCircleSettings : T extends 'ellipse' ? ToolsEllipseSettings : T extends 'text' ? ToolsTextSettings : T extends 'line' ? ToolsLineSettings : T extends 'brush' ? ToolsBrushSettings : T extends 'polygon' ? ToolsPolygonSettings : T extends 'curve' ? ToolsCurveSettings : T extends 'triangle' ? ToolsTriangleSettings : T extends 'picture' ? ToolsPictureSettings : unknown;
|
|
117
118
|
export type ActionsType = 'selection' | 'undo' | 'redo' | 'clear' | 'export' | 'loadfile' | 'savefile' | 'move' | 'uploadpicture' | 'addurlpicture';
|
|
118
119
|
export type ActionsTool = {
|
|
119
120
|
id: string;
|
package/dist/types/utils.d.ts
CHANGED
package/dist/utils/data.d.ts
CHANGED
|
@@ -1,225 +1,4 @@
|
|
|
1
|
-
import type { DrawableShape, DrawableShapeJson, ExportDataType } from '../types/Shapes';
|
|
1
|
+
import type { DrawableShape, DrawableShapeJson, ExportDataType, ShapeEntity } from '../types/Shapes';
|
|
2
2
|
export declare const cleanShapesBeforeExport: (shapes: DrawableShape[]) => DrawableShapeJson[];
|
|
3
3
|
export declare const buildDataToExport: (shapes: DrawableShape[], width: number, height: number) => ExportDataType;
|
|
4
|
-
export declare const addDefaultAndTempShapeProps: (shape: DrawableShape) =>
|
|
5
|
-
id: string;
|
|
6
|
-
visible?: boolean | undefined;
|
|
7
|
-
locked?: boolean | undefined;
|
|
8
|
-
style?: {
|
|
9
|
-
fillColor?: string | undefined;
|
|
10
|
-
globalAlpha?: number | undefined;
|
|
11
|
-
strokeColor?: string | undefined;
|
|
12
|
-
lineWidth?: number | undefined;
|
|
13
|
-
lineDash?: number | undefined;
|
|
14
|
-
lineArrow?: number | undefined;
|
|
15
|
-
pointsCount?: number | undefined;
|
|
16
|
-
fontFamily?: string | undefined;
|
|
17
|
-
fontItalic?: boolean | undefined;
|
|
18
|
-
fontBold?: boolean | undefined;
|
|
19
|
-
} | undefined;
|
|
20
|
-
x: number;
|
|
21
|
-
y: number;
|
|
22
|
-
width: number;
|
|
23
|
-
height: number;
|
|
24
|
-
toolId?: string | undefined;
|
|
25
|
-
rotation: number;
|
|
26
|
-
type: "rect";
|
|
27
|
-
} | {
|
|
28
|
-
id: string;
|
|
29
|
-
visible?: boolean | undefined;
|
|
30
|
-
locked?: boolean | undefined;
|
|
31
|
-
style?: {
|
|
32
|
-
fillColor?: string | undefined;
|
|
33
|
-
globalAlpha?: number | undefined;
|
|
34
|
-
strokeColor?: string | undefined;
|
|
35
|
-
lineWidth?: number | undefined;
|
|
36
|
-
lineDash?: number | undefined;
|
|
37
|
-
lineArrow?: number | undefined;
|
|
38
|
-
pointsCount?: number | undefined;
|
|
39
|
-
fontFamily?: string | undefined;
|
|
40
|
-
fontItalic?: boolean | undefined;
|
|
41
|
-
fontBold?: boolean | undefined;
|
|
42
|
-
} | undefined;
|
|
43
|
-
x: number;
|
|
44
|
-
y: number;
|
|
45
|
-
width: number;
|
|
46
|
-
height: number;
|
|
47
|
-
toolId?: string | undefined;
|
|
48
|
-
rotation: number;
|
|
49
|
-
type: "square";
|
|
50
|
-
} | {
|
|
51
|
-
id: string;
|
|
52
|
-
visible?: boolean | undefined;
|
|
53
|
-
locked?: boolean | undefined;
|
|
54
|
-
style?: {
|
|
55
|
-
fillColor?: string | undefined;
|
|
56
|
-
globalAlpha?: number | undefined;
|
|
57
|
-
strokeColor?: string | undefined;
|
|
58
|
-
lineWidth?: number | undefined;
|
|
59
|
-
lineDash?: number | undefined;
|
|
60
|
-
lineArrow?: number | undefined;
|
|
61
|
-
pointsCount?: number | undefined;
|
|
62
|
-
fontFamily?: string | undefined;
|
|
63
|
-
fontItalic?: boolean | undefined;
|
|
64
|
-
fontBold?: boolean | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
x: number;
|
|
67
|
-
y: number;
|
|
68
|
-
width: number;
|
|
69
|
-
height: number;
|
|
70
|
-
src: string;
|
|
71
|
-
img: HTMLImageElement;
|
|
72
|
-
toolId?: string | undefined;
|
|
73
|
-
rotation: number;
|
|
74
|
-
type: "picture";
|
|
75
|
-
} | {
|
|
76
|
-
id: string;
|
|
77
|
-
visible?: boolean | undefined;
|
|
78
|
-
locked?: boolean | undefined;
|
|
79
|
-
style?: {
|
|
80
|
-
fillColor?: string | undefined;
|
|
81
|
-
globalAlpha?: number | undefined;
|
|
82
|
-
strokeColor?: string | undefined;
|
|
83
|
-
lineWidth?: number | undefined;
|
|
84
|
-
lineDash?: number | undefined;
|
|
85
|
-
lineArrow?: number | undefined;
|
|
86
|
-
pointsCount?: number | undefined;
|
|
87
|
-
fontFamily?: string | undefined;
|
|
88
|
-
fontItalic?: boolean | undefined;
|
|
89
|
-
fontBold?: boolean | undefined;
|
|
90
|
-
} | undefined;
|
|
91
|
-
x: number;
|
|
92
|
-
y: number;
|
|
93
|
-
width: number;
|
|
94
|
-
height: number;
|
|
95
|
-
value: string[];
|
|
96
|
-
fontSize: number;
|
|
97
|
-
toolId?: string | undefined;
|
|
98
|
-
rotation: number;
|
|
99
|
-
type: "text";
|
|
100
|
-
} | {
|
|
101
|
-
id: string;
|
|
102
|
-
visible?: boolean | undefined;
|
|
103
|
-
locked?: boolean | undefined;
|
|
104
|
-
style?: {
|
|
105
|
-
fillColor?: string | undefined;
|
|
106
|
-
globalAlpha?: number | undefined;
|
|
107
|
-
strokeColor?: string | undefined;
|
|
108
|
-
lineWidth?: number | undefined;
|
|
109
|
-
lineDash?: number | undefined;
|
|
110
|
-
lineArrow?: number | undefined;
|
|
111
|
-
pointsCount?: number | undefined;
|
|
112
|
-
fontFamily?: string | undefined;
|
|
113
|
-
fontItalic?: boolean | undefined;
|
|
114
|
-
fontBold?: boolean | undefined;
|
|
115
|
-
} | undefined;
|
|
116
|
-
points: [import("../types/Shapes").Point, import("../types/Shapes").Point];
|
|
117
|
-
toolId?: string | undefined;
|
|
118
|
-
rotation: number;
|
|
119
|
-
type: "line";
|
|
120
|
-
} | {
|
|
121
|
-
id: string;
|
|
122
|
-
visible?: boolean | undefined;
|
|
123
|
-
locked?: boolean | undefined;
|
|
124
|
-
style?: {
|
|
125
|
-
fillColor?: string | undefined;
|
|
126
|
-
globalAlpha?: number | undefined;
|
|
127
|
-
strokeColor?: string | undefined;
|
|
128
|
-
lineWidth?: number | undefined;
|
|
129
|
-
lineDash?: number | undefined;
|
|
130
|
-
lineArrow?: number | undefined;
|
|
131
|
-
pointsCount?: number | undefined;
|
|
132
|
-
fontFamily?: string | undefined;
|
|
133
|
-
fontItalic?: boolean | undefined;
|
|
134
|
-
fontBold?: boolean | undefined;
|
|
135
|
-
} | undefined;
|
|
136
|
-
points: import("../types/Shapes").Point[];
|
|
137
|
-
toolId?: string | undefined;
|
|
138
|
-
rotation: number;
|
|
139
|
-
type: "polygon";
|
|
140
|
-
} | {
|
|
141
|
-
id: string;
|
|
142
|
-
visible?: boolean | undefined;
|
|
143
|
-
locked?: boolean | undefined;
|
|
144
|
-
style?: {
|
|
145
|
-
fillColor?: string | undefined;
|
|
146
|
-
globalAlpha?: number | undefined;
|
|
147
|
-
strokeColor?: string | undefined;
|
|
148
|
-
lineWidth?: number | undefined;
|
|
149
|
-
lineDash?: number | undefined;
|
|
150
|
-
lineArrow?: number | undefined;
|
|
151
|
-
pointsCount?: number | undefined;
|
|
152
|
-
fontFamily?: string | undefined;
|
|
153
|
-
fontItalic?: boolean | undefined;
|
|
154
|
-
fontBold?: boolean | undefined;
|
|
155
|
-
} | undefined;
|
|
156
|
-
points: import("../types/Shapes").Point[];
|
|
157
|
-
toolId?: string | undefined;
|
|
158
|
-
rotation: number;
|
|
159
|
-
type: "curve";
|
|
160
|
-
} | {
|
|
161
|
-
id: string;
|
|
162
|
-
visible?: boolean | undefined;
|
|
163
|
-
locked?: boolean | undefined;
|
|
164
|
-
style?: {
|
|
165
|
-
fillColor?: string | undefined;
|
|
166
|
-
globalAlpha?: number | undefined;
|
|
167
|
-
strokeColor?: string | undefined;
|
|
168
|
-
lineWidth?: number | undefined;
|
|
169
|
-
lineDash?: number | undefined;
|
|
170
|
-
lineArrow?: number | undefined;
|
|
171
|
-
pointsCount?: number | undefined;
|
|
172
|
-
fontFamily?: string | undefined;
|
|
173
|
-
fontItalic?: boolean | undefined;
|
|
174
|
-
fontBold?: boolean | undefined;
|
|
175
|
-
} | undefined;
|
|
176
|
-
points: import("../types/Shapes").Point[][];
|
|
177
|
-
toolId?: string | undefined;
|
|
178
|
-
rotation: number;
|
|
179
|
-
type: "brush";
|
|
180
|
-
} | {
|
|
181
|
-
id: string;
|
|
182
|
-
visible?: boolean | undefined;
|
|
183
|
-
locked?: boolean | undefined;
|
|
184
|
-
style?: {
|
|
185
|
-
fillColor?: string | undefined;
|
|
186
|
-
globalAlpha?: number | undefined;
|
|
187
|
-
strokeColor?: string | undefined;
|
|
188
|
-
lineWidth?: number | undefined;
|
|
189
|
-
lineDash?: number | undefined;
|
|
190
|
-
lineArrow?: number | undefined;
|
|
191
|
-
pointsCount?: number | undefined;
|
|
192
|
-
fontFamily?: string | undefined;
|
|
193
|
-
fontItalic?: boolean | undefined;
|
|
194
|
-
fontBold?: boolean | undefined;
|
|
195
|
-
} | undefined;
|
|
196
|
-
x: number;
|
|
197
|
-
y: number;
|
|
198
|
-
radius: number;
|
|
199
|
-
toolId?: string | undefined;
|
|
200
|
-
rotation: number;
|
|
201
|
-
type: "circle";
|
|
202
|
-
} | {
|
|
203
|
-
id: string;
|
|
204
|
-
visible?: boolean | undefined;
|
|
205
|
-
locked?: boolean | undefined;
|
|
206
|
-
style?: {
|
|
207
|
-
fillColor?: string | undefined;
|
|
208
|
-
globalAlpha?: number | undefined;
|
|
209
|
-
strokeColor?: string | undefined;
|
|
210
|
-
lineWidth?: number | undefined;
|
|
211
|
-
lineDash?: number | undefined;
|
|
212
|
-
lineArrow?: number | undefined;
|
|
213
|
-
pointsCount?: number | undefined;
|
|
214
|
-
fontFamily?: string | undefined;
|
|
215
|
-
fontItalic?: boolean | undefined;
|
|
216
|
-
fontBold?: boolean | undefined;
|
|
217
|
-
} | undefined;
|
|
218
|
-
x: number;
|
|
219
|
-
y: number;
|
|
220
|
-
radiusX: number;
|
|
221
|
-
radiusY: number;
|
|
222
|
-
toolId?: string | undefined;
|
|
223
|
-
rotation: number;
|
|
224
|
-
type: "ellipse";
|
|
225
|
-
};
|
|
4
|
+
export declare const addDefaultAndTempShapeProps: (shape: DrawableShape, currentScale: number, selectionPadding: number) => ShapeEntity;
|
package/dist/utils/file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DrawableShape, ExportDataType, Point } from '../types/Shapes';
|
|
1
|
+
import type { DrawableShape, ExportDataType, Point, ShapeEntity } from '../types/Shapes';
|
|
2
2
|
export declare const addSizeAndConvertSvgToObjectUrl: (svgFileContent: string) => string;
|
|
3
3
|
export declare const isSvg: (fileOrUrl: File | string) => boolean;
|
|
4
4
|
export declare const fetchAndStringify: (url: string) => Promise<string>;
|
|
@@ -7,4 +7,4 @@ export declare const getBase64Image: (img: HTMLImageElement) => string;
|
|
|
7
7
|
export declare const getCanvasImage: (shapes: DrawableShape[], canvasOffset: Point, width: number, height: number, selectionPadding: number) => string;
|
|
8
8
|
export declare const encodeShapesInString: (shapes: DrawableShape[], width: number, height: number) => string;
|
|
9
9
|
export declare const decodeJson: (file: File) => Promise<unknown>;
|
|
10
|
-
export declare const decodeImportedData: (shapesForJson: ExportDataType) => Promise<
|
|
10
|
+
export declare const decodeImportedData: (shapesForJson: ExportDataType, currentScale: number, selectionPadding: number) => Promise<ShapeEntity[]>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GridFormatType } from '
|
|
2
|
-
import type { Point } from '
|
|
1
|
+
import { GridFormatType } from '../constants/app';
|
|
2
|
+
import type { Point } from '../types/Shapes';
|
|
3
3
|
export declare const drawGrid: (ctx: CanvasRenderingContext2D, width: number, height: number, responsiveScale: number, canvasOffset: Point, gridFormat: GridFormatType) => void;
|