@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
|
@@ -1,165 +1,147 @@
|
|
|
1
1
|
import { DrawableShapeJson, Point } from '../types/Shapes';
|
|
2
2
|
export declare const migrateShapesV065: (shapes: DrawableShapeJson[]) => (({
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
} & {
|
|
10
|
-
id: string;
|
|
11
|
-
toolId?: string | undefined;
|
|
3
|
+
visible?: boolean | undefined;
|
|
4
|
+
locked?: boolean | undefined;
|
|
12
5
|
rotation: number;
|
|
6
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
7
|
+
} & import("../types/Shapes").Triangle & {
|
|
8
|
+
type: "triangle";
|
|
9
|
+
path?: Path2D | undefined;
|
|
13
10
|
} & {
|
|
14
|
-
type: "rect";
|
|
15
|
-
}) | ({
|
|
16
11
|
translation?: Point | undefined;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
width: number;
|
|
21
|
-
height: number;
|
|
22
|
-
} & {
|
|
23
|
-
id: string;
|
|
24
|
-
toolId?: string | undefined;
|
|
12
|
+
}) | ({
|
|
13
|
+
visible?: boolean | undefined;
|
|
14
|
+
locked?: boolean | undefined;
|
|
25
15
|
rotation: number;
|
|
16
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
17
|
+
} & import("../types/Shapes").Line & {
|
|
18
|
+
type: "line";
|
|
19
|
+
selection?: import("../types/Shapes").SelectionLinesType | undefined;
|
|
20
|
+
path?: Path2D | undefined;
|
|
21
|
+
arrows?: import("../types/Shapes").DrawableShape<"triangle">[] | undefined;
|
|
26
22
|
} & {
|
|
27
|
-
type: "square";
|
|
28
|
-
}) | ({
|
|
29
23
|
translation?: Point | undefined;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
width: number;
|
|
34
|
-
height: number;
|
|
35
|
-
} & {
|
|
36
|
-
src: string;
|
|
37
|
-
} & {
|
|
38
|
-
id: string;
|
|
39
|
-
toolId?: string | undefined;
|
|
24
|
+
}) | ({
|
|
25
|
+
visible?: boolean | undefined;
|
|
26
|
+
locked?: boolean | undefined;
|
|
40
27
|
rotation: number;
|
|
28
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
29
|
+
} & import("../types/Shapes").Rect & {
|
|
30
|
+
src: string;
|
|
41
31
|
} & {
|
|
42
32
|
type: "picture";
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} & import("../types/Shapes").StyledShape & {
|
|
46
|
-
x: number;
|
|
47
|
-
y: number;
|
|
48
|
-
width: number;
|
|
49
|
-
height: number;
|
|
33
|
+
img: HTMLImageElement;
|
|
34
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
50
35
|
} & {
|
|
36
|
+
translation?: Point | undefined;
|
|
37
|
+
}) | ({
|
|
38
|
+
visible?: boolean | undefined;
|
|
39
|
+
locked?: boolean | undefined;
|
|
40
|
+
rotation: number;
|
|
41
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
42
|
+
} & import("../types/Shapes").Rect & {
|
|
51
43
|
value: string[];
|
|
52
44
|
fontSize: number;
|
|
53
|
-
} & {
|
|
54
|
-
id: string;
|
|
55
|
-
toolId?: string | undefined;
|
|
56
|
-
rotation: number;
|
|
57
45
|
} & {
|
|
58
46
|
type: "text";
|
|
59
|
-
|
|
60
|
-
translation?: Point | undefined;
|
|
61
|
-
} & import("../types/Shapes").StyledShape & {
|
|
62
|
-
points: [Point, Point];
|
|
47
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
63
48
|
} & {
|
|
64
|
-
|
|
65
|
-
|
|
49
|
+
translation?: Point | undefined;
|
|
50
|
+
}) | ({
|
|
51
|
+
visible?: boolean | undefined;
|
|
52
|
+
locked?: boolean | undefined;
|
|
66
53
|
rotation: number;
|
|
54
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
55
|
+
} & import("../types/Shapes").Rect & {
|
|
56
|
+
type: "rect";
|
|
57
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
58
|
+
path?: Path2D | undefined;
|
|
67
59
|
} & {
|
|
68
|
-
type: "line";
|
|
69
|
-
}) | ({
|
|
70
60
|
translation?: Point | undefined;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
id: string;
|
|
75
|
-
toolId?: string | undefined;
|
|
61
|
+
}) | ({
|
|
62
|
+
visible?: boolean | undefined;
|
|
63
|
+
locked?: boolean | undefined;
|
|
76
64
|
rotation: number;
|
|
65
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
66
|
+
} & import("../types/Shapes").Rect & {
|
|
67
|
+
type: "square";
|
|
68
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
69
|
+
path?: Path2D | undefined;
|
|
77
70
|
} & {
|
|
78
|
-
type: "polygon";
|
|
79
|
-
}) | ({
|
|
80
71
|
translation?: Point | undefined;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
id: string;
|
|
85
|
-
toolId?: string | undefined;
|
|
72
|
+
}) | ({
|
|
73
|
+
visible?: boolean | undefined;
|
|
74
|
+
locked?: boolean | undefined;
|
|
86
75
|
rotation: number;
|
|
76
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
77
|
+
} & import("../types/Shapes").Circle & {
|
|
78
|
+
type: "circle";
|
|
79
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
80
|
+
path?: Path2D | undefined;
|
|
87
81
|
} & {
|
|
88
|
-
type: "curve";
|
|
89
|
-
}) | ({
|
|
90
82
|
translation?: Point | undefined;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
id: string;
|
|
95
|
-
toolId?: string | undefined;
|
|
83
|
+
}) | ({
|
|
84
|
+
visible?: boolean | undefined;
|
|
85
|
+
locked?: boolean | undefined;
|
|
96
86
|
rotation: number;
|
|
87
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
88
|
+
} & import("../types/Shapes").Ellipse & {
|
|
89
|
+
type: "ellipse";
|
|
90
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
91
|
+
path?: Path2D | undefined;
|
|
97
92
|
} & {
|
|
98
|
-
type: "brush";
|
|
99
|
-
}) | ({
|
|
100
93
|
translation?: Point | undefined;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
radius: number;
|
|
105
|
-
} & {
|
|
106
|
-
id: string;
|
|
107
|
-
toolId?: string | undefined;
|
|
94
|
+
}) | ({
|
|
95
|
+
visible?: boolean | undefined;
|
|
96
|
+
locked?: boolean | undefined;
|
|
108
97
|
rotation: number;
|
|
98
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
99
|
+
} & import("../types/Shapes").Polygon & {
|
|
100
|
+
type: "polygon";
|
|
101
|
+
selection?: import("../types/Shapes").SelectionLinesType | undefined;
|
|
102
|
+
path?: Path2D | undefined;
|
|
109
103
|
} & {
|
|
110
|
-
type: "circle";
|
|
111
|
-
}) | ({
|
|
112
104
|
translation?: Point | undefined;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
105
|
+
}) | ({
|
|
106
|
+
visible?: boolean | undefined;
|
|
107
|
+
locked?: boolean | undefined;
|
|
108
|
+
rotation: number;
|
|
109
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
110
|
+
} & import("../types/Shapes").Curve & {
|
|
111
|
+
type: "curve";
|
|
112
|
+
selection?: import("../types/Shapes").SelectionLinesType | undefined;
|
|
113
|
+
path?: Path2D | undefined;
|
|
118
114
|
} & {
|
|
119
|
-
|
|
120
|
-
|
|
115
|
+
translation?: Point | undefined;
|
|
116
|
+
}) | ({
|
|
117
|
+
visible?: boolean | undefined;
|
|
118
|
+
locked?: boolean | undefined;
|
|
121
119
|
rotation: number;
|
|
120
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
121
|
+
} & import("../types/Shapes").Brush & {
|
|
122
|
+
type: "brush";
|
|
123
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
124
|
+
path?: Path2D | undefined;
|
|
125
|
+
scaleX?: number | undefined;
|
|
126
|
+
scaleY?: number | undefined;
|
|
122
127
|
} & {
|
|
123
|
-
|
|
128
|
+
translation?: Point | undefined;
|
|
124
129
|
}) | {
|
|
125
130
|
x: number;
|
|
126
131
|
y: number;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
globalAlpha?: number | undefined;
|
|
130
|
-
strokeColor?: string | undefined;
|
|
131
|
-
lineWidth?: number | undefined;
|
|
132
|
-
lineDash?: number | undefined;
|
|
133
|
-
lineArrow?: number | undefined;
|
|
134
|
-
pointsCount?: number | undefined;
|
|
135
|
-
fontFamily?: string | undefined;
|
|
136
|
-
fontItalic?: boolean | undefined;
|
|
137
|
-
fontBold?: boolean | undefined;
|
|
138
|
-
} | undefined;
|
|
132
|
+
selection?: import("../types/Shapes").SelectionDefaultType | undefined;
|
|
133
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
139
134
|
type: "rect" | "square" | "circle" | "ellipse" | "picture";
|
|
140
135
|
rotation: number;
|
|
141
|
-
toolId?: string | undefined;
|
|
142
|
-
id: string;
|
|
143
136
|
visible?: boolean | undefined;
|
|
144
137
|
locked?: boolean | undefined;
|
|
145
138
|
} | {
|
|
146
139
|
points: Point[];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
globalAlpha?: number | undefined;
|
|
150
|
-
strokeColor?: string | undefined;
|
|
151
|
-
lineWidth?: number | undefined;
|
|
152
|
-
lineDash?: number | undefined;
|
|
153
|
-
lineArrow?: number | undefined;
|
|
154
|
-
pointsCount?: number | undefined;
|
|
155
|
-
fontFamily?: string | undefined;
|
|
156
|
-
fontItalic?: boolean | undefined;
|
|
157
|
-
fontBold?: boolean | undefined;
|
|
158
|
-
} | undefined;
|
|
140
|
+
selection?: import("../types/Shapes").SelectionLinesType | undefined;
|
|
141
|
+
style?: import("../types/Shapes").StyleShape | undefined;
|
|
159
142
|
type: "polygon" | "curve";
|
|
160
143
|
rotation: number;
|
|
161
|
-
|
|
162
|
-
id: string;
|
|
144
|
+
path?: Path2D | undefined;
|
|
163
145
|
visible?: boolean | undefined;
|
|
164
146
|
locked?: boolean | undefined;
|
|
165
147
|
} | undefined)[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DrawableShape, Point, SelectionLinesType } from "src/types/Shapes";
|
|
2
|
+
export declare const createLineSelectionPath: (shape: DrawableShape & {
|
|
3
|
+
points: readonly Point[];
|
|
4
|
+
}, currentScale: number, selectionPadding: number, gravityAnchors?: boolean) => SelectionLinesType;
|
|
5
|
+
export declare const drawLineSelection: ({ ctx, shape, withAnchors, selectionWidth, selectionColor, currentScale }: {
|
|
6
|
+
ctx: CanvasRenderingContext2D;
|
|
7
|
+
shape: DrawableShape<'line'> | DrawableShape<'polygon'> | DrawableShape<'curve'>;
|
|
8
|
+
withAnchors: boolean;
|
|
9
|
+
selectionWidth: number;
|
|
10
|
+
selectionColor: string;
|
|
11
|
+
currentScale?: number | undefined;
|
|
12
|
+
}) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Point, DrawableShape, SelectionDefaultType } from '../../types/Shapes';
|
|
2
|
+
import type { SelectionModeResize } from '../../types/Mode';
|
|
3
|
+
import type { GridFormatType } from '../../constants/app';
|
|
4
|
+
export declare const createRecSelectionPath: (rect: DrawableShape, currentScale: number, selectionPadding: number) => SelectionDefaultType;
|
|
5
|
+
export declare const drawSelectionRect: (ctx: CanvasRenderingContext2D, shape: DrawableShape & {
|
|
6
|
+
selection?: SelectionDefaultType;
|
|
7
|
+
}, selectionColor: string, selectionWidth: number, currentScale: number, withAnchors: boolean) => void;
|
|
8
|
+
export declare const resizeRectSelection: (cursorPosition: Point, originalShape: DrawableShape, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, keepRatio?: boolean) => {
|
|
9
|
+
borderX: number;
|
|
10
|
+
borderHeight: number;
|
|
11
|
+
borderY: number;
|
|
12
|
+
borderWidth: number;
|
|
13
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HoverModeData, SelectionModeData } from '../types/Mode';
|
|
2
|
-
import type { Point,
|
|
3
|
-
export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape:
|
|
4
|
-
export declare const selectShape: (shapes:
|
|
2
|
+
import type { Point, ShapeEntity } from '../types/Shapes';
|
|
3
|
+
export declare const getNewSelectionData: (hoverMode: HoverModeData, selectedShape: ShapeEntity, cursorPosition: Point, selectionPadding: number) => SelectionModeData<Point | number> | undefined;
|
|
4
|
+
export declare const selectShape: (shapes: ShapeEntity[], cursorPosition: Point, currentScale: number, canvasOffset: Point, selectedShape: ShapeEntity | undefined, selectionPadding: number) => {
|
|
5
5
|
mode: SelectionModeData<Point | number>;
|
|
6
|
-
shape:
|
|
6
|
+
shape: ShapeEntity | undefined;
|
|
7
7
|
};
|
|
@@ -1,55 +1,20 @@
|
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
1
2
|
import { SelectionModeResize } from '../../types/Mode';
|
|
2
|
-
import type { Point,
|
|
3
|
+
import type { Point, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
|
|
3
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshBrush: <T extends DrawableShape<"brush">>(brush: T, currentScale: number, selectionPadding: number) => T;
|
|
4
6
|
export declare const createBrush: (shape: {
|
|
5
7
|
id: string;
|
|
6
|
-
icon: string;
|
|
7
|
-
label: string;
|
|
8
8
|
type: 'brush';
|
|
9
9
|
settings: ToolsSettingsType<'brush'>;
|
|
10
|
-
}, cursorPosition: Point) =>
|
|
11
|
-
export declare const drawBrush: (ctx: CanvasRenderingContext2D,
|
|
12
|
-
export declare const getBrushBorder: (brush:
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const addNewPointToShape: (shape: DrawableBrush, cursorPosition: Point) => {
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'brush'>;
|
|
11
|
+
export declare const drawBrush: (ctx: CanvasRenderingContext2D, shape: DrawableShape<'brush'>) => void;
|
|
12
|
+
export declare const getBrushBorder: (brush: DrawableShape<'brush'>, selectionPadding: number) => Rect;
|
|
13
|
+
export declare const translateBrush: <U extends DrawableShape<"brush">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
14
|
points: Point[][];
|
|
16
|
-
visible?: boolean | undefined;
|
|
17
|
-
locked?: boolean | undefined;
|
|
18
|
-
style?: {
|
|
19
|
-
fillColor?: string | undefined;
|
|
20
|
-
globalAlpha?: number | undefined;
|
|
21
|
-
strokeColor?: string | undefined;
|
|
22
|
-
lineWidth?: number | undefined;
|
|
23
|
-
lineDash?: number | undefined;
|
|
24
|
-
lineArrow?: number | undefined;
|
|
25
|
-
pointsCount?: number | undefined;
|
|
26
|
-
fontFamily?: string | undefined;
|
|
27
|
-
fontItalic?: boolean | undefined;
|
|
28
|
-
fontBold?: boolean | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
id: string;
|
|
31
|
-
toolId?: string | undefined;
|
|
32
|
-
rotation: number;
|
|
33
|
-
type: "brush";
|
|
34
15
|
};
|
|
35
|
-
export declare const
|
|
16
|
+
export declare const resizeBrush: (cursorPosition: Point, originalShape: DrawableShape<'brush'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio: boolean) => DrawableShape<'brush'>;
|
|
17
|
+
export declare const addNewPointToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T & {
|
|
36
18
|
points: Point[][];
|
|
37
|
-
visible?: boolean | undefined;
|
|
38
|
-
locked?: boolean | undefined;
|
|
39
|
-
style?: {
|
|
40
|
-
fillColor?: string | undefined;
|
|
41
|
-
globalAlpha?: number | undefined;
|
|
42
|
-
strokeColor?: string | undefined;
|
|
43
|
-
lineWidth?: number | undefined;
|
|
44
|
-
lineDash?: number | undefined;
|
|
45
|
-
lineArrow?: number | undefined;
|
|
46
|
-
pointsCount?: number | undefined;
|
|
47
|
-
fontFamily?: string | undefined;
|
|
48
|
-
fontItalic?: boolean | undefined;
|
|
49
|
-
fontBold?: boolean | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
id: string;
|
|
52
|
-
toolId?: string | undefined;
|
|
53
|
-
rotation: number;
|
|
54
|
-
type: "brush";
|
|
55
19
|
};
|
|
20
|
+
export declare const addNewPointGroupToShape: <T extends DrawableShape<"brush">>(shape: T, cursorPosition: Point, currentScale: number, selectionPadding: number) => T;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
1
2
|
import { SelectionModeResize } from '../../types/Mode';
|
|
2
|
-
import type { Point,
|
|
3
|
+
import type { Point, Circle, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
|
|
3
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshCircle: <T extends DrawableShape<"circle">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
4
6
|
export declare const createCircle: (shape: {
|
|
5
7
|
id: string;
|
|
6
|
-
icon: string;
|
|
7
|
-
label: string;
|
|
8
8
|
type: 'circle';
|
|
9
9
|
settings: ToolsSettingsType<'circle'>;
|
|
10
|
-
}, cursorPosition: Point) =>
|
|
11
|
-
export declare const drawCircle: (ctx: CanvasRenderingContext2D, circle:
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'circle'>;
|
|
11
|
+
export declare const drawCircle: (ctx: CanvasRenderingContext2D, circle: DrawableShape<'circle'>) => void;
|
|
12
12
|
export declare const getCircleBorder: (circle: Circle, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const translateCircle: <U extends DrawableShape<"circle">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const resizeCircle: (cursorPosition: Point, originalShape: DrawableShape<'circle'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'circle'>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
2
|
+
import { SelectionModeResize } from '../../types/Mode';
|
|
3
|
+
import type { Point, DrawableShape, ShapeEntity } from '../../types/Shapes';
|
|
2
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshCurve: <T extends DrawableShape<"curve">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
3
6
|
export declare const createCurve: (shape: {
|
|
4
7
|
id: string;
|
|
5
|
-
icon: string;
|
|
6
|
-
label: string;
|
|
7
8
|
type: 'curve';
|
|
8
9
|
settings: ToolsSettingsType<'curve'>;
|
|
9
|
-
}, cursorPosition: Point) =>
|
|
10
|
-
export declare const
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'curve'>;
|
|
11
|
+
export declare const resizeCurve: (cursorPosition: Point, canvasOffset: Point, originalShape: DrawableShape<'curve'>, selectionMode: SelectionModeResize<number>, gridFormat: GridFormatType, selectionPadding: number, currentScale: number) => DrawableShape<'curve'>;
|
|
12
|
+
export declare const drawCurve: (ctx: CanvasRenderingContext2D, curve: DrawableShape<'curve'>) => void;
|
|
11
13
|
export declare const getCurveBorder: (polygon: import("../../types/Shapes").Polygon, selectionPadding: number) => import("../../types/Shapes").Rect;
|
|
14
|
+
export declare const translateCurve: <U extends DrawableShape<"curve">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
15
|
+
points: [number, number][];
|
|
16
|
+
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import { GridFormatType } from '../../constants/app';
|
|
1
2
|
import { SelectionModeResize } from '../../types/Mode';
|
|
2
|
-
import type { Point,
|
|
3
|
+
import type { Point, Ellipse, Rect, DrawableShape, ShapeEntity } from '../../types/Shapes';
|
|
3
4
|
import type { ToolsSettingsType } from '../../types/tools';
|
|
5
|
+
export declare const refreshEllipse: <T extends DrawableShape<"ellipse">>(shape: T, currentScale: number, selectionPadding: number) => T;
|
|
4
6
|
export declare const createEllipse: (shape: {
|
|
5
7
|
id: string;
|
|
6
|
-
icon: string;
|
|
7
|
-
label: string;
|
|
8
8
|
type: 'ellipse';
|
|
9
9
|
settings: ToolsSettingsType<'ellipse'>;
|
|
10
|
-
}, cursorPosition: Point) =>
|
|
11
|
-
export declare const drawEllipse: (ctx: CanvasRenderingContext2D, ellipse:
|
|
10
|
+
}, cursorPosition: Point, currentScale: number, selectionPadding: number) => ShapeEntity<'ellipse'>;
|
|
11
|
+
export declare const drawEllipse: (ctx: CanvasRenderingContext2D, ellipse: DrawableShape<'ellipse'>) => void;
|
|
12
12
|
export declare const getEllipseBorder: (ellipse: Ellipse, selectionPadding: number) => Rect;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const translateEllipse: <U extends DrawableShape<"ellipse">>(cursorPosition: Point, originalShape: U, originalCursorPosition: Point, gridFormat: GridFormatType, currentScale: number, selectionPadding: number) => U & {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const resizeEllipse: (cursorPosition: Point, originalShape: DrawableShape<'ellipse'>, selectionMode: SelectionModeResize, gridFormat: GridFormatType, selectionPadding: number, currentScale: number, keepRatio?: boolean) => DrawableShape<'ellipse'>;
|