@abidibo/react-cam-roi 0.2.4 → 0.2.5
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 +14 -1
- package/dist/index.cjs.js +104 -21
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +104 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/types/Components/RoiEditor/Canvas.d.ts +2 -0
- package/dist/types/Components/RoiEditor/Types.d.ts +34 -0
- package/dist/types/Components/RoiEditor/Utils.d.ts +24 -0
- package/dist/types/Providers/EditorProvider.d.ts +2 -1
- package/package.json +1 -1
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as fabric from 'fabric';
|
1
2
|
import { Output } from './Types';
|
2
3
|
type CanvasProps = {
|
3
4
|
canvasSize: {
|
@@ -9,6 +10,7 @@ type CanvasProps = {
|
|
9
10
|
height: number;
|
10
11
|
};
|
11
12
|
initialData?: Output;
|
13
|
+
canvasRef: React.MutableRefObject<fabric.Canvas | null>;
|
12
14
|
};
|
13
15
|
declare const Canvas: React.FC<CanvasProps>;
|
14
16
|
export default Canvas;
|
@@ -79,6 +79,11 @@ export type Metadata = {
|
|
79
79
|
}[];
|
80
80
|
};
|
81
81
|
export type OutputShapeRect = {
|
82
|
+
angle: number;
|
83
|
+
scaleX: number;
|
84
|
+
scaleY: number;
|
85
|
+
skewX: number;
|
86
|
+
skewY: number;
|
82
87
|
top: number;
|
83
88
|
left: number;
|
84
89
|
width: number;
|
@@ -86,6 +91,11 @@ export type OutputShapeRect = {
|
|
86
91
|
color: string;
|
87
92
|
};
|
88
93
|
export type OutputShapePolyline = {
|
94
|
+
angle: number;
|
95
|
+
scaleX: number;
|
96
|
+
scaleY: number;
|
97
|
+
skewX: number;
|
98
|
+
skewY: number;
|
89
99
|
points: {
|
90
100
|
x: number;
|
91
101
|
y: number;
|
@@ -95,6 +105,11 @@ export type OutputShapePolyline = {
|
|
95
105
|
color: string;
|
96
106
|
};
|
97
107
|
export type OutputShapePolygon = {
|
108
|
+
angle: number;
|
109
|
+
scaleX: number;
|
110
|
+
scaleY: number;
|
111
|
+
skewX: number;
|
112
|
+
skewY: number;
|
98
113
|
points: {
|
99
114
|
x: number;
|
100
115
|
y: number;
|
@@ -103,6 +118,24 @@ export type OutputShapePolygon = {
|
|
103
118
|
left: number;
|
104
119
|
color: string;
|
105
120
|
};
|
121
|
+
export type OutputRectCoords = {
|
122
|
+
points: {
|
123
|
+
x: number;
|
124
|
+
y: number;
|
125
|
+
}[];
|
126
|
+
};
|
127
|
+
export type OutputPolylineCoords = {
|
128
|
+
points: {
|
129
|
+
x: number;
|
130
|
+
y: number;
|
131
|
+
}[];
|
132
|
+
};
|
133
|
+
export type OutputPolygonCoords = {
|
134
|
+
points: {
|
135
|
+
x: number;
|
136
|
+
y: number;
|
137
|
+
}[];
|
138
|
+
};
|
106
139
|
export interface OutputParameter {
|
107
140
|
codename: string;
|
108
141
|
value: number | string | boolean | string[] | number[] | null;
|
@@ -114,6 +147,7 @@ export interface OutputRoi {
|
|
114
147
|
role: string;
|
115
148
|
id: string;
|
116
149
|
shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon;
|
150
|
+
coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords;
|
117
151
|
}
|
118
152
|
export interface Output {
|
119
153
|
parameters: OutputParameter[];
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import * as fabric from 'fabric';
|
1
2
|
import { Configuration, ConfigurationParameter, INotify, Metadata, Shape, Shapes, ShapeType, ToolEnum } from './Types';
|
2
3
|
export declare const notify: INotify;
|
3
4
|
export declare const enableRois: (configuration: Configuration) => boolean;
|
@@ -9,6 +10,11 @@ export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, i
|
|
9
10
|
width: number;
|
10
11
|
height: number;
|
11
12
|
}) => {
|
13
|
+
angle: fabric.TDegree;
|
14
|
+
scaleX: number;
|
15
|
+
scaleY: number;
|
16
|
+
skewX: number;
|
17
|
+
skewY: number;
|
12
18
|
top: number;
|
13
19
|
left: number;
|
14
20
|
width: number;
|
@@ -20,6 +26,24 @@ export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, i
|
|
20
26
|
top: number;
|
21
27
|
left: number;
|
22
28
|
color: string;
|
29
|
+
angle: fabric.TDegree;
|
30
|
+
scaleX: number;
|
31
|
+
scaleY: number;
|
32
|
+
skewX: number;
|
33
|
+
skewY: number;
|
23
34
|
width?: undefined;
|
24
35
|
height?: undefined;
|
25
36
|
};
|
37
|
+
export declare function getAbsoluteRectData(rect: fabric.Rect): {
|
38
|
+
x: number;
|
39
|
+
y: number;
|
40
|
+
}[];
|
41
|
+
export declare const fabricShapeToOutputCoords: (shape: Shape, type: ShapeType, imageSize: {
|
42
|
+
width: number;
|
43
|
+
height: number;
|
44
|
+
}) => {
|
45
|
+
points: {
|
46
|
+
x: number;
|
47
|
+
y: number;
|
48
|
+
}[];
|
49
|
+
};
|
@@ -7,6 +7,7 @@ type EditorContextType = {
|
|
7
7
|
activeColor: string;
|
8
8
|
setActiveColor: (color: string) => void;
|
9
9
|
shapes: Shapes;
|
10
|
+
setShapes: (shapes: Shapes) => void;
|
10
11
|
addShape: (id: string, type: ShapeType, shape: Shape) => void;
|
11
12
|
addShapes: (shapes: {
|
12
13
|
id: string;
|
@@ -22,5 +23,5 @@ type EditorContextType = {
|
|
22
23
|
};
|
23
24
|
export declare const EditorContext: import("react").Context<EditorContextType | undefined>;
|
24
25
|
export declare function useEditorContext(): EditorContextType;
|
25
|
-
declare const EditorProvider: ({ children, editorId, hideForbiddenTools, activeTool, setActiveTool, activeColor, setActiveColor, shapes, addShape, addShapes, removeShape, configuration, metadata, setMetadata, onSubmit, }: PropsWithChildren<EditorContextType>) => import("react/jsx-runtime").JSX.Element;
|
26
|
+
declare const EditorProvider: ({ children, editorId, hideForbiddenTools, activeTool, setActiveTool, activeColor, setActiveColor, shapes, setShapes, addShape, addShapes, removeShape, configuration, metadata, setMetadata, onSubmit, }: PropsWithChildren<EditorContextType>) => import("react/jsx-runtime").JSX.Element;
|
26
27
|
export default EditorProvider;
|