@abidibo/react-cam-roi 0.4.0 → 0.6.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.
- package/README.md +38 -3
- package/dist/index.cjs.js +118 -20
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +118 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/types/Components/RoiEditor/Point.d.ts +18 -0
- package/dist/types/Components/RoiEditor/Types.d.ts +19 -4
- package/dist/types/Components/RoiEditor/Utils.d.ts +18 -0
- package/dist/types/Icons/PointIcon.d.ts +6 -0
- package/dist/types/Providers/UiProvider.d.ts +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -65,14 +65,31 @@ export type RoiEditorProps = {
|
|
65
65
|
|
66
66
|
export const enum ToolEnum {
|
67
67
|
Pointer = 'pointer',
|
68
|
+
Point = 'point',
|
68
69
|
Polyline = 'polyline',
|
69
70
|
Polygon = 'polygon',
|
70
71
|
Rectangle = 'rect',
|
71
72
|
}
|
72
73
|
|
73
|
-
export type ShapeType = ToolEnum.Polyline | ToolEnum.Polygon | ToolEnum.Rectangle
|
74
|
+
export type ShapeType = ToolEnum.Polyline | ToolEnum.Polygon | ToolEnum.Rectangle | ToolEnum.Point
|
75
|
+
|
76
|
+
export type OutputShapePoint = {
|
77
|
+
angle: number
|
78
|
+
scaleX: number
|
79
|
+
scaleY: number
|
80
|
+
skewX: number
|
81
|
+
skewY: number
|
82
|
+
top: number
|
83
|
+
left: number
|
84
|
+
color: string
|
85
|
+
}
|
74
86
|
|
75
87
|
export type OutputShapeRect = {
|
88
|
+
angle: number
|
89
|
+
scaleX: number
|
90
|
+
scaleY: number
|
91
|
+
skewX: number
|
92
|
+
skewY: number
|
76
93
|
top: number
|
77
94
|
left: number
|
78
95
|
width: number
|
@@ -81,6 +98,11 @@ export type OutputShapeRect = {
|
|
81
98
|
}
|
82
99
|
|
83
100
|
export type OutputShapePolyline = {
|
101
|
+
angle: number
|
102
|
+
scaleX: number
|
103
|
+
scaleY: number
|
104
|
+
skewX: number
|
105
|
+
skewY: number
|
84
106
|
points: { x: number; y: number }[]
|
85
107
|
top: number
|
86
108
|
left: number
|
@@ -88,12 +110,22 @@ export type OutputShapePolyline = {
|
|
88
110
|
}
|
89
111
|
|
90
112
|
export type OutputShapePolygon = {
|
113
|
+
angle: number
|
114
|
+
scaleX: number
|
115
|
+
scaleY: number
|
116
|
+
skewX: number
|
117
|
+
skewY: number
|
91
118
|
points: { x: number; y: number }[]
|
92
119
|
top: number
|
93
120
|
left: number
|
94
121
|
color: string
|
95
122
|
}
|
96
123
|
|
124
|
+
export type OutputPointCoords = {
|
125
|
+
x: number
|
126
|
+
y: number
|
127
|
+
}
|
128
|
+
|
97
129
|
export type OutputRectCoords = {
|
98
130
|
points: { x: number; y: number }[]
|
99
131
|
}
|
@@ -116,8 +148,8 @@ export interface OutputRoi {
|
|
116
148
|
type: ShapeType
|
117
149
|
name: string
|
118
150
|
role: string
|
119
|
-
shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon // fabric obj coords
|
120
|
-
coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords // canvas coords
|
151
|
+
shape: OutputShapeRect | OutputShapePolyline | OutputShapePolygon | OutputShapePoint // fabric obj coords
|
152
|
+
coords: OutputRectCoords | OutputPolylineCoords | OutputPolygonCoords | OutputPointCoords // canvas coords
|
121
153
|
}
|
122
154
|
export interface Output {
|
123
155
|
parameters: OutputParameter[]
|
@@ -305,6 +337,7 @@ type UiContextType = {
|
|
305
337
|
notify: INotify // function used to display notifications
|
306
338
|
strings: { // strings used here and there
|
307
339
|
cancel: string
|
340
|
+
cannotDrawMorePoints: string
|
308
341
|
cannotDrawMorePolygons: string
|
309
342
|
cannotDrawMorePolylines: string
|
310
343
|
cannotDrawMoreRectangles: string
|
@@ -321,6 +354,8 @@ type UiContextType = {
|
|
321
354
|
roiMultiplicityLteRule: string // with {role}, {type} and {threshold} placeholder
|
322
355
|
roiMultiplicityNoRule: string // with {role}, {type}
|
323
356
|
name: string
|
357
|
+
point: string
|
358
|
+
pointHelpText: string
|
324
359
|
polygon: string
|
325
360
|
polygonHelpText: string
|
326
361
|
polyline: string
|
package/dist/index.cjs.js
CHANGED
@@ -319,6 +319,17 @@ var fabricShapeToOutputShape = function (shape, type, imageSize) {
|
|
319
319
|
height: abs2Perc(shape.height, imageSize.height),
|
320
320
|
color: shape.stroke,
|
321
321
|
};
|
322
|
+
case "point" /* ToolEnum.Point */:
|
323
|
+
return {
|
324
|
+
angle: shape.angle,
|
325
|
+
scaleX: shape.scaleX,
|
326
|
+
scaleY: shape.scaleY,
|
327
|
+
skewX: shape.skewX,
|
328
|
+
skewY: shape.skewY,
|
329
|
+
top: abs2Perc(shape.top, imageSize.height),
|
330
|
+
left: abs2Perc(shape.left, imageSize.width),
|
331
|
+
color: shape.stroke,
|
332
|
+
};
|
322
333
|
case "polygon" /* ToolEnum.Polygon */:
|
323
334
|
case "polyline" /* ToolEnum.Polyline */:
|
324
335
|
return {
|
@@ -386,6 +397,11 @@ var fabricShapeToOutputCoords = function (shape, type, imageSize) {
|
|
386
397
|
});
|
387
398
|
})
|
388
399
|
};
|
400
|
+
case "point" /* ToolEnum.Point */:
|
401
|
+
return {
|
402
|
+
x: abs2Perc(shape.left, imageSize.width),
|
403
|
+
y: abs2Perc(shape.top, imageSize.height),
|
404
|
+
};
|
389
405
|
case "polygon" /* ToolEnum.Polygon */:
|
390
406
|
case "polyline" /* ToolEnum.Polyline */:
|
391
407
|
return {
|
@@ -515,6 +531,7 @@ var DefaultUiContext = {
|
|
515
531
|
notify: notify,
|
516
532
|
strings: {
|
517
533
|
cancel: 'Cancel',
|
534
|
+
cannotDrawMorePoints: 'You cannot draw more points',
|
518
535
|
cannotDrawMorePolygons: 'You cannot draw more polygons',
|
519
536
|
cannotDrawMorePolylines: 'You cannot draw more polylines',
|
520
537
|
cannotDrawMoreRectangles: 'You cannot draw more rectangles',
|
@@ -524,6 +541,8 @@ var DefaultUiContext = {
|
|
524
541
|
missingRequiredValuesInMainParameters: 'Missing required values in main parameters',
|
525
542
|
missingRequiredValuesInShapeParameters: 'Missing required values in shape {id} parameters',
|
526
543
|
name: 'Name',
|
544
|
+
point: 'Point',
|
545
|
+
pointHelpText: 'click to draw the point',
|
527
546
|
polygon: 'Polygon',
|
528
547
|
polygonHelpText: 'click to draw all the polygon points, double click on the last point to close the polygon',
|
529
548
|
polyline: 'Polyline',
|
@@ -936,6 +955,52 @@ var copyRectangle = function (editorId, canvas, rectangle) {
|
|
936
955
|
return copy;
|
937
956
|
};
|
938
957
|
|
958
|
+
var handleMouseDownPoint = function (event, editorId, canvas, activeColor, setOriginX, setOriginY) {
|
959
|
+
var pointer = canvas.getScenePoint(event.e);
|
960
|
+
setOriginX(pointer.x);
|
961
|
+
setOriginY(pointer.y);
|
962
|
+
var id = v4();
|
963
|
+
var newCircle = new Gn({
|
964
|
+
left: pointer.x,
|
965
|
+
top: pointer.y,
|
966
|
+
originX: 'center',
|
967
|
+
originY: 'center',
|
968
|
+
radius: 6,
|
969
|
+
fill: 'transparent',
|
970
|
+
stroke: activeColor,
|
971
|
+
strokeWidth: 2,
|
972
|
+
strokeUniform: true,
|
973
|
+
selectable: false,
|
974
|
+
hasControls: false,
|
975
|
+
hoverCursor: 'default',
|
976
|
+
id: id,
|
977
|
+
});
|
978
|
+
canvas.add(newCircle);
|
979
|
+
Dispatcher.emit("canvas:".concat(editorId, ":shapeAdded"), { id: id, type: "point" /* ToolEnum.Point */, shape: newCircle });
|
980
|
+
canvas.defaultCursor = 'default';
|
981
|
+
};
|
982
|
+
var copyPoint = function (editorId, canvas, point) {
|
983
|
+
var id = v4();
|
984
|
+
var copy = new Gn({
|
985
|
+
left: point.left + 10,
|
986
|
+
top: point.top + 10,
|
987
|
+
originX: 'center',
|
988
|
+
originY: 'center',
|
989
|
+
radius: 6,
|
990
|
+
fill: 'transparent',
|
991
|
+
stroke: point.stroke,
|
992
|
+
strokeWidth: point.strokeWidth,
|
993
|
+
strokeUniform: true,
|
994
|
+
selectable: false,
|
995
|
+
hasControls: false,
|
996
|
+
hoverCursor: 'default',
|
997
|
+
id: id,
|
998
|
+
});
|
999
|
+
canvas.add(copy);
|
1000
|
+
Dispatcher.emit("canvas:".concat(editorId, ":shapeAdded"), { id: id, type: "point" /* ToolEnum.Point */, shape: copy });
|
1001
|
+
return copy;
|
1002
|
+
};
|
1003
|
+
|
939
1004
|
var useImageSize = function (imageUrl) {
|
940
1005
|
var _a = React.useState({ width: 0, height: 0 }), imageSize = _a[0], setImageSize = _a[1];
|
941
1006
|
React.useEffect(function () {
|
@@ -981,11 +1046,34 @@ var initCanvasData = function (canvasRef, imageSize, addShapes, metadata, setMet
|
|
981
1046
|
var m_1 = [];
|
982
1047
|
var s_1 = [];
|
983
1048
|
initialData.rois.forEach(function (r) {
|
984
|
-
var _a, _b, _c;
|
1049
|
+
var _a, _b, _c, _d;
|
985
1050
|
log('info', enableLogs !== null && enableLogs !== void 0 ? enableLogs : false, 'Loading initial shape', r);
|
986
1051
|
var id = r.id;
|
987
1052
|
var shape;
|
988
1053
|
switch (r.type) {
|
1054
|
+
case "point" /* ToolEnum.Point */:
|
1055
|
+
shape = new Gn({
|
1056
|
+
angle: r.shape.angle || 0,
|
1057
|
+
scaleX: r.shape.scaleX || 1,
|
1058
|
+
scaleY: r.shape.scaleY || 1,
|
1059
|
+
skewX: r.shape.skewX || 0,
|
1060
|
+
skewY: r.shape.skewY || 0,
|
1061
|
+
left: perc2Abs(r.shape.left, imageSize.width),
|
1062
|
+
top: perc2Abs(r.shape.top, imageSize.height),
|
1063
|
+
originX: 'center',
|
1064
|
+
originY: 'center',
|
1065
|
+
radius: 6,
|
1066
|
+
fill: 'transparent',
|
1067
|
+
stroke: r.shape.color,
|
1068
|
+
strokeWidth: 2,
|
1069
|
+
strokeUniform: true,
|
1070
|
+
selectable: false,
|
1071
|
+
hasControls: false,
|
1072
|
+
hoverCursor: 'default',
|
1073
|
+
id: id,
|
1074
|
+
});
|
1075
|
+
(_a = canvasRef.current) === null || _a === void 0 ? void 0 : _a.add(shape);
|
1076
|
+
break;
|
989
1077
|
case "rect" /* ToolEnum.Rectangle */:
|
990
1078
|
shape = new fr({
|
991
1079
|
angle: r.shape.angle || 0,
|
@@ -1008,7 +1096,7 @@ var initCanvasData = function (canvasRef, imageSize, addShapes, metadata, setMet
|
|
1008
1096
|
hoverCursor: 'default',
|
1009
1097
|
id: id,
|
1010
1098
|
});
|
1011
|
-
(
|
1099
|
+
(_b = canvasRef.current) === null || _b === void 0 ? void 0 : _b.add(shape);
|
1012
1100
|
break;
|
1013
1101
|
case "polygon" /* ToolEnum.Polygon */:
|
1014
1102
|
shape = new oo(r.shape.points.map(function (_a) {
|
@@ -1035,7 +1123,7 @@ var initCanvasData = function (canvasRef, imageSize, addShapes, metadata, setMet
|
|
1035
1123
|
// @ts-expect-error id is not included in types but the property is added and it works
|
1036
1124
|
id: id,
|
1037
1125
|
});
|
1038
|
-
(
|
1126
|
+
(_c = canvasRef.current) === null || _c === void 0 ? void 0 : _c.add(shape);
|
1039
1127
|
break;
|
1040
1128
|
case "polyline" /* ToolEnum.Polyline */:
|
1041
1129
|
shape = new no(r.shape.points.map(function (_a) {
|
@@ -1061,7 +1149,7 @@ var initCanvasData = function (canvasRef, imageSize, addShapes, metadata, setMet
|
|
1061
1149
|
hoverCursor: 'default',
|
1062
1150
|
id: id,
|
1063
1151
|
});
|
1064
|
-
(
|
1152
|
+
(_d = canvasRef.current) === null || _d === void 0 ? void 0 : _d.add(shape);
|
1065
1153
|
break;
|
1066
1154
|
}
|
1067
1155
|
m_1.push({ id: id, parameters: r.parameters, name: r.name, role: r.role });
|
@@ -1086,7 +1174,7 @@ var useTool = function (canvas) {
|
|
1086
1174
|
var _a;
|
1087
1175
|
Dispatcher.emit("canvas:".concat(editorId, ":shapeSelected"), (_a = event.selected) !== null && _a !== void 0 ? _a : null);
|
1088
1176
|
}, [editorId]);
|
1089
|
-
var handleRefreshShapes = React.useCallback(function () { return setShapes(__assign({}, shapes)); }, [shapes]);
|
1177
|
+
var handleRefreshShapes = React.useCallback(function () { return setShapes(__assign({}, shapes)); }, [shapes]); // eslint-disable-line
|
1090
1178
|
// Handler for selection cleared event to reset selected shapes state
|
1091
1179
|
var handleSelectionCleared = React.useCallback(function () {
|
1092
1180
|
Dispatcher.emit("canvas:".concat(editorId, ":shapeSelected"), null);
|
@@ -1113,6 +1201,11 @@ var useTool = function (canvas) {
|
|
1113
1201
|
}
|
1114
1202
|
var handleMouseDown = function (event) {
|
1115
1203
|
switch (activeTool) {
|
1204
|
+
case "point" /* ToolEnum.Point */:
|
1205
|
+
if (!canDrawShape(configuration, "point" /* ToolEnum.Point */, shapes, notify, strings.cannotDrawMorePoints))
|
1206
|
+
return;
|
1207
|
+
handleMouseDownPoint(event, editorId, canvas, activeColor, setOriginX, setOriginY);
|
1208
|
+
break;
|
1116
1209
|
case "rect" /* ToolEnum.Rectangle */:
|
1117
1210
|
if (!canDrawShape(configuration, "rect" /* ToolEnum.Rectangle */, shapes, notify, strings.cannotDrawMoreRectangles))
|
1118
1211
|
return;
|
@@ -1213,6 +1306,13 @@ var useDispatcherEvents = function (canvas) {
|
|
1213
1306
|
var obj = canvas === null || canvas === void 0 ? void 0 : canvas.getObjects().find(function (s) { return s.id === id; });
|
1214
1307
|
var copy;
|
1215
1308
|
switch (obj === null || obj === void 0 ? void 0 : obj.type) {
|
1309
|
+
case 'circle': // a ToolEnum.Point is drawed like a circle with fixed radius
|
1310
|
+
if (!canDrawShape(configuration, "point" /* ToolEnum.Point */, shapes, notify, strings.cannotDrawMorePoints))
|
1311
|
+
return;
|
1312
|
+
copy = copyPoint(editorId, canvas, obj);
|
1313
|
+
// @ts-expect-error id exists but his stupid ts does not know
|
1314
|
+
Dispatcher.emit("canvas:".concat(editorId, ":selectShape"), copy.id);
|
1315
|
+
break;
|
1216
1316
|
case "polygon" /* ToolEnum.Polygon */:
|
1217
1317
|
if (!canDrawShape(configuration, "polygon" /* ToolEnum.Polygon */, shapes, notify, strings.cannotDrawMorePolygons))
|
1218
1318
|
return;
|
@@ -1346,27 +1446,18 @@ var Header = function () {
|
|
1346
1446
|
|
1347
1447
|
var styles$5 = {"canvas-wrapper":"RoiEditor-module_canvas-wrapper__q0gQg"};
|
1348
1448
|
|
1349
|
-
var isAllowed = function (role, multiplicity, metadata) {
|
1350
|
-
switch (multiplicity.operator) {
|
1351
|
-
case OperatorEnum.Eq:
|
1352
|
-
case OperatorEnum.Lte:
|
1353
|
-
return metadata.rois.filter(function (m) { return m.role === role; }).length < multiplicity.threshold;
|
1354
|
-
case OperatorEnum.Lt:
|
1355
|
-
return metadata.rois.filter(function (m) { return m.role === role; }).length < multiplicity.threshold - 1;
|
1356
|
-
default:
|
1357
|
-
return true;
|
1358
|
-
}
|
1359
|
-
};
|
1360
1449
|
var RoleField = function (_a) {
|
1361
1450
|
var onChange = _a.onChange, value = _a.value, required = _a.required, shapeType = _a.shapeType, props = __rest(_a, ["onChange", "value", "required", "shapeType"]);
|
1362
1451
|
var _b = React.useContext(UiContext), strings = _b.strings, EnumField = _b.EnumField;
|
1363
|
-
var
|
1452
|
+
var configuration = useEditorContext().configuration /*, metadata*/;
|
1364
1453
|
var options = [];
|
1365
1454
|
var rois = configuration.rois || [];
|
1366
1455
|
rois
|
1367
1456
|
.filter(function (r) { return r.type === shapeType; })
|
1368
1457
|
.forEach(function (r) {
|
1369
|
-
|
1458
|
+
// the following causes problems with initial data when all shapes are drawn, no roles appear in the edit dropdown
|
1459
|
+
// if (!options.includes(r.role) && (!r.multiplicity || isAllowed(r.role, r.multiplicity!, metadata))) {
|
1460
|
+
if (!options.includes(r.role)) {
|
1370
1461
|
options.push(r.role);
|
1371
1462
|
}
|
1372
1463
|
});
|
@@ -1548,6 +1639,11 @@ var ColorPicker = function (_a) {
|
|
1548
1639
|
|
1549
1640
|
var styles$1 = {"toolbar":"Toolbar-module_toolbar__ywNcv","toolbar-light":"Toolbar-module_toolbar-light__aJtaH","toolbar-dark":"Toolbar-module_toolbar-dark__9iO4U","toolbar-helper":"Toolbar-module_toolbar-helper__DBw3v","toolbar-helper-light":"Toolbar-module_toolbar-helper-light__Z4PLG","toolbar-helper-dark":"Toolbar-module_toolbar-helper-dark__AEXUy","toolbar-spacer":"Toolbar-module_toolbar-spacer__qPxmN","toolbar-spacer-light":"Toolbar-module_toolbar-spacer-light__2CNYP","toolbar-spacer-dark":"Toolbar-module_toolbar-spacer-dark__cW0Rj"};
|
1550
1641
|
|
1642
|
+
var PointIcon = function (_a) {
|
1643
|
+
var _b = _a.color, color = _b === void 0 ? 'black' : _b, _c = _a.style, style = _c === void 0 ? { height: '32px' } : _c;
|
1644
|
+
return (jsxRuntime.jsxs("svg", { style: style, width: "25", height: "25", viewBox: "0 0 25 25", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsxRuntime.jsx("circle", { cx: "9.5", cy: "15.5", r: "4.5", fill: color }), jsxRuntime.jsx("path", { d: "M19.5 0 L21.5 0 L21.5 3.5 L25 3.5 L25 5.5 L21.5 5.5 L21.5 9 L19.5 9 L19.5 5.5 L16 5.5 L16 3.5 L19.5 3.5 Z", stroke: color, "stroke-width": ".6", fill: color })] }));
|
1645
|
+
};
|
1646
|
+
|
1551
1647
|
var Toolbar = function () {
|
1552
1648
|
var _a;
|
1553
1649
|
var _b = React.useContext(UiContext), IconButton = _b.IconButton, themeMode = _b.themeMode, primaryColor = _b.primaryColor, Typography = _b.Typography, strings = _b.strings;
|
@@ -1555,12 +1651,14 @@ var Toolbar = function () {
|
|
1555
1651
|
var iconColor = function (tool) { return (tool === activeTool ? primaryColor : themeMode === 'light' ? 'black' : 'white'); };
|
1556
1652
|
var setTool = function (tool) { return function () { return setActiveTool(tool); }; };
|
1557
1653
|
var hideForbiddenTools = (_a = configuration.options) === null || _a === void 0 ? void 0 : _a.hideForbiddenTools;
|
1654
|
+
var pointEnabled = configuration.rois.find(function (r) { return r.type === "point" /* ToolEnum.Point */; }) &&
|
1655
|
+
canDrawShape(configuration, "point" /* ToolEnum.Point */, shapes);
|
1558
1656
|
var polylineEnabled = configuration.rois.find(function (r) { return r.type === "polyline" /* ToolEnum.Polyline */; }) &&
|
1559
1657
|
canDrawShape(configuration, "polyline" /* ToolEnum.Polyline */, shapes);
|
1560
1658
|
var polygonEnabled = configuration.rois.find(function (r) { return r.type === "polygon" /* ToolEnum.Polygon */; }) && canDrawShape(configuration, "polygon" /* ToolEnum.Polygon */, shapes);
|
1561
1659
|
var rectangleEnabled = configuration.rois.find(function (r) { return r.type === "rect" /* ToolEnum.Rectangle */; }) &&
|
1562
1660
|
canDrawShape(configuration, "rect" /* ToolEnum.Rectangle */, shapes);
|
1563
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: css('toolbar', styles$1, themeMode), children: enableRois(configuration) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconButton, { onClick: setTool("pointer" /* ToolEnum.Pointer */), children: jsxRuntime.jsx(PointerIcon, { color: iconColor("pointer" /* ToolEnum.Pointer */) }) }), (!hideForbiddenTools || polylineEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("polyline" /* ToolEnum.Polyline */), disabled: !polylineEnabled, children: jsxRuntime.jsx(PolylineIcon, { color: iconColor("polyline" /* ToolEnum.Polyline */) }) })), (!hideForbiddenTools || polygonEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("polygon" /* ToolEnum.Polygon */), disabled: !polygonEnabled, children: jsxRuntime.jsx(PolygonIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) })), (!hideForbiddenTools || rectangleEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("rect" /* ToolEnum.Rectangle */), disabled: !rectangleEnabled, children: jsxRuntime.jsx(RectangleIcon, { color: iconColor("rect" /* ToolEnum.Rectangle */) }) })), jsxRuntime.jsx(ColorPicker, { style: { marginLeft: 'auto', marginRight: '.5rem' } })] })) }), enableRois(configuration) && (jsxRuntime.jsx("div", { className: css('toolbar-helper', styles$1, themeMode), children: jsxRuntime.jsxs(Typography, { children: [strings[activeTool], ": ", strings["".concat(activeTool, "HelpText")]] }) }))] }));
|
1661
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: css('toolbar', styles$1, themeMode), children: enableRois(configuration) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(IconButton, { onClick: setTool("pointer" /* ToolEnum.Pointer */), children: jsxRuntime.jsx(PointerIcon, { color: iconColor("pointer" /* ToolEnum.Pointer */) }) }), (!hideForbiddenTools || pointEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("point" /* ToolEnum.Point */), disabled: !pointEnabled, children: jsxRuntime.jsx(PointIcon, { color: iconColor("point" /* ToolEnum.Point */) }) })), (!hideForbiddenTools || polylineEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("polyline" /* ToolEnum.Polyline */), disabled: !polylineEnabled, children: jsxRuntime.jsx(PolylineIcon, { color: iconColor("polyline" /* ToolEnum.Polyline */) }) })), (!hideForbiddenTools || polygonEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("polygon" /* ToolEnum.Polygon */), disabled: !polygonEnabled, children: jsxRuntime.jsx(PolygonIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) })), (!hideForbiddenTools || rectangleEnabled) && (jsxRuntime.jsx(IconButton, { onClick: setTool("rect" /* ToolEnum.Rectangle */), disabled: !rectangleEnabled, children: jsxRuntime.jsx(RectangleIcon, { color: iconColor("rect" /* ToolEnum.Rectangle */) }) })), jsxRuntime.jsx(ColorPicker, { style: { marginLeft: 'auto', marginRight: '.5rem' } })] })) }), enableRois(configuration) && (jsxRuntime.jsx("div", { className: css('toolbar-helper', styles$1, themeMode), children: jsxRuntime.jsxs(Typography, { children: [strings[activeTool], ": ", strings["".concat(activeTool, "HelpText")]] }) }))] }));
|
1564
1662
|
};
|
1565
1663
|
|
1566
1664
|
var styles = {"top-bar":"TopBar-module_top-bar__9oCUR","main-parameters-view":"TopBar-module_main-parameters-view__f-0SX","main-parameters-view-light":"TopBar-module_main-parameters-view-light__o-dbi","main-parameters-view-dark":"TopBar-module_main-parameters-view-dark__FnEnj","main-parameters-button":"TopBar-module_main-parameters-button__9JX--"};
|
@@ -1632,7 +1730,7 @@ var RoiEditor = function (_a) {
|
|
1632
1730
|
role: (_g = (_f = metadata.rois.find(function (r) { return r.id === shapeId; })) === null || _f === void 0 ? void 0 : _f.role) !== null && _g !== void 0 ? _g : '',
|
1633
1731
|
type: shapes[shapeId].type,
|
1634
1732
|
id: shapeId,
|
1635
|
-
shape: fabricShapeToOutputShape(shapes[shapeId].shape, shapes[shapeId].
|
1733
|
+
shape: fabricShapeToOutputShape(shapes[shapeId].shape, shapes[shapeId].type, imageSize),
|
1636
1734
|
coords: fabricShapeToOutputCoords(shapes[shapeId].shape, shapes[shapeId].shape.type, imageSize),
|
1637
1735
|
});
|
1638
1736
|
}),
|