@abidibo/react-cam-roi 0.2.4 → 0.2.6
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 +113 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +113 -27
- package/dist/index.esm.js.map +1 -1
- package/dist/types/Components/BoolField/index.d.ts +2 -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 +25 -1
- package/dist/types/Providers/EditorProvider.d.ts +2 -1
- package/package.json +2 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
import { FieldProps } from "../../Types";
|
2
|
-
declare const BoolField: React.FC<Omit<FieldProps<boolean>, 'onChange'> & {
|
2
|
+
declare const BoolField: React.FC<Omit<FieldProps<boolean>, 'onChange' | 'value'> & {
|
3
3
|
onChange: (value: boolean) => void;
|
4
|
+
checked: boolean;
|
4
5
|
}>;
|
5
6
|
export default BoolField;
|
@@ -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,14 +1,20 @@
|
|
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;
|
4
5
|
export declare const enableMainMetadata: (configuration: Configuration) => boolean;
|
5
6
|
export declare const canDrawShape: (configuration: Configuration, shapeType: Omit<ToolEnum, ToolEnum.Pointer>, shapes: Shapes, notify?: INotify, message?: string) => boolean;
|
6
|
-
export declare const validateParametersForm: (parameters: ConfigurationParameter[], fields: Record<string, unknown>, setErrors: (errors: Record<string, string>) => void) => boolean;
|
7
|
+
export declare const validateParametersForm: (parameters: ConfigurationParameter[], fields: Record<string, unknown>, setErrors: (errors: Record<string, string>) => void, strings: Record<string, string>) => boolean;
|
7
8
|
export declare const validate: (configuration: Configuration, shapes: Shapes, metadata: Metadata, strings: Record<string, string>) => [boolean, string[]];
|
8
9
|
export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, imageSize: {
|
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;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@abidibo/react-cam-roi",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.6",
|
4
4
|
"description": "A react component for drawing ROI over images and managing metadata",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -99,6 +99,7 @@
|
|
99
99
|
"rollup-plugin-postcss": "^4.0.2",
|
100
100
|
"semantic-release": "^24.2.2",
|
101
101
|
"storybook": "^8.4.7",
|
102
|
+
"tinyglobby": "^0.2.13",
|
102
103
|
"typescript": "^5.7.3",
|
103
104
|
"typescript-eslint": "^8.20.0"
|
104
105
|
},
|