@abidibo/react-cam-roi 0.4.0 → 0.5.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.
@@ -0,0 +1,18 @@
1
+ import * as fabric from 'fabric';
2
+ import { FabricEvent } from './Types';
3
+ export declare const handleMouseDownPoint: (event: FabricEvent, editorId: string, canvas: fabric.Canvas, activeColor: string, setOriginX: (v: number) => void, setOriginY: (v: number) => void) => void;
4
+ export declare const copyPoint: (editorId: string, canvas: fabric.Canvas, point: fabric.Circle) => fabric.Circle<{
5
+ left: number;
6
+ top: number;
7
+ originX: "center";
8
+ originY: "center";
9
+ radius: number;
10
+ fill: string | fabric.TFiller | null;
11
+ stroke: string | fabric.TFiller | null;
12
+ strokeWidth: number;
13
+ strokeUniform: true;
14
+ selectable: false;
15
+ hasControls: false;
16
+ hoverCursor: string;
17
+ id: string;
18
+ }, fabric.SerializedCircleProps, fabric.ObjectEvents>;
@@ -1,12 +1,13 @@
1
1
  import * as fabric from 'fabric';
2
2
  export declare const enum ToolEnum {
3
3
  Pointer = "pointer",
4
+ Point = "point",
4
5
  Polyline = "polyline",
5
6
  Polygon = "polygon",
6
7
  Rectangle = "rect"
7
8
  }
8
- export type ShapeType = ToolEnum.Polyline | ToolEnum.Polygon | ToolEnum.Rectangle;
9
- export type Shape = (fabric.Rect | fabric.Polygon | fabric.Polyline) & {
9
+ export type ShapeType = ToolEnum.Polyline | ToolEnum.Polygon | ToolEnum.Rectangle | ToolEnum.Point;
10
+ export type Shape = (fabric.Rect | fabric.Polygon | fabric.Polyline | fabric.Circle) & {
10
11
  id?: string;
11
12
  };
12
13
  export type Shapes = Record<string, {
@@ -91,6 +92,16 @@ export type OutputShapeRect = {
91
92
  height: number;
92
93
  color: string;
93
94
  };
95
+ export type OutputShapePoint = {
96
+ angle: number;
97
+ scaleX: number;
98
+ scaleY: number;
99
+ skewX: number;
100
+ skewY: number;
101
+ top: number;
102
+ left: number;
103
+ color: string;
104
+ };
94
105
  export type OutputShapePolyline = {
95
106
  angle: number;
96
107
  scaleX: number;
@@ -125,6 +136,10 @@ export type OutputRectCoords = {
125
136
  y: number;
126
137
  }[];
127
138
  };
139
+ export type OutputPointCoords = {
140
+ x: number;
141
+ y: number;
142
+ };
128
143
  export type OutputPolylineCoords = {
129
144
  points: {
130
145
  x: number;
@@ -147,8 +162,8 @@ export interface OutputRoi {
147
162
  name: string;
148
163
  role: string;
149
164
  id: string;
150
- shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon;
151
- coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords;
165
+ shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon | OutputShapePoint;
166
+ coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords | OutputPointCoords;
152
167
  }
153
168
  export interface Output {
154
169
  parameters: OutputParameter[];
@@ -21,6 +21,18 @@ export declare const fabricShapeToOutputShape: (shape: Shape, type: ShapeType, i
21
21
  height: number;
22
22
  color: string;
23
23
  points?: undefined;
24
+ } | {
25
+ angle: fabric.TDegree;
26
+ scaleX: number;
27
+ scaleY: number;
28
+ skewX: number;
29
+ skewY: number;
30
+ top: number;
31
+ left: number;
32
+ color: string;
33
+ width?: undefined;
34
+ height?: undefined;
35
+ points?: undefined;
24
36
  } | {
25
37
  points: any;
26
38
  top: number;
@@ -46,4 +58,10 @@ export declare const fabricShapeToOutputCoords: (shape: Shape, type: ShapeType,
46
58
  x: number;
47
59
  y: number;
48
60
  }[];
61
+ x?: undefined;
62
+ y?: undefined;
63
+ } | {
64
+ x: number;
65
+ y: number;
66
+ points?: undefined;
49
67
  };
@@ -0,0 +1,6 @@
1
+ type PointIconProps = {
2
+ color?: string;
3
+ style?: React.CSSProperties;
4
+ };
5
+ declare const PointIcon: React.FC<PointIconProps>;
6
+ export default PointIcon;
@@ -38,6 +38,7 @@ type UiContextType = {
38
38
  notify: INotify;
39
39
  strings: {
40
40
  cancel: string;
41
+ cannotDrawMorePoints: string;
41
42
  cannotDrawMorePolygons: string;
42
43
  cannotDrawMorePolylines: string;
43
44
  cannotDrawMoreRectangles: string;
@@ -53,6 +54,8 @@ type UiContextType = {
53
54
  roiMultiplicityLteRule: string;
54
55
  roiMultiplicityNoRule: string;
55
56
  name: string;
57
+ point: string;
58
+ pointHelpText: string;
56
59
  polygon: string;
57
60
  polygonHelpText: string;
58
61
  polyline: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abidibo/react-cam-roi",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A react component for drawing ROI over images and managing metadata",
5
5
  "repository": {
6
6
  "type": "git",