@abidibo/react-cam-roi 0.14.0 → 0.14.2

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/dist/index.esm.js CHANGED
@@ -98,7 +98,15 @@ var log = function (level, enable) {
98
98
  return enable && console[level].apply(console, args);
99
99
  };
100
100
  var css = function (name, styles, themeMode) {
101
- return "".concat(styles[name], " ").concat(styles["".concat(name, "-").concat(themeMode)], " react-cam-roi-").concat(name).concat(themeMode ? "react-cam-roi-".concat(name, "-").concat(themeMode) : '');
101
+ var parts = [];
102
+ if (styles[name])
103
+ parts.push(styles[name]);
104
+ if (styles["".concat(name, "-").concat(themeMode)])
105
+ parts.push(styles["".concat(name, "-").concat(themeMode)]);
106
+ parts.push("react-cam-roi-".concat(name));
107
+ if (themeMode)
108
+ parts.push("react-cam-roi-".concat(name, "-").concat(themeMode));
109
+ return parts.join(' ');
102
110
  };
103
111
  var humanize = function (str) {
104
112
  return str
@@ -1731,7 +1739,7 @@ var styles$1 = {"toolbar":"Toolbar-module_toolbar__ywNcv","toolbar-light":"Toolb
1731
1739
 
1732
1740
  var Toolbar = function (_a) {
1733
1741
  var _b;
1734
- var canvasRef = _a.canvasRef, imageSize = _a.imageSize;
1742
+ var canvasRef = _a.canvasRef, canvasSize = _a.canvasSize;
1735
1743
  var _c = useContext(UiContext), IconButton = _c.IconButton, themeMode = _c.themeMode, primaryColor = _c.primaryColor, Typography = _c.Typography, strings = _c.strings, Tooltip = _c.Tooltip;
1736
1744
  var _d = useEditorContext(), activeTool = _d.activeTool, setActiveTool = _d.setActiveTool, configuration = _d.configuration, shapes = _d.shapes, editorId = _d.editorId, activeColor = _d.activeColor;
1737
1745
  var iconColor = function (tool) { return (tool === activeTool ? primaryColor : themeMode === 'light' ? 'black' : 'white'); };
@@ -1746,7 +1754,7 @@ var Toolbar = function (_a) {
1746
1754
  var handleRenderFullImagePolygon = function () {
1747
1755
  if (!canvasRef.current)
1748
1756
  return;
1749
- renderFullImagePolygon(editorId, canvasRef.current, activeColor, imageSize);
1757
+ renderFullImagePolygon(editorId, canvasRef.current, activeColor, canvasSize);
1750
1758
  };
1751
1759
  return (jsxs(Fragment, { children: [jsx("div", { className: css('toolbar', styles$1, themeMode), children: enableRois(configuration) && (jsxs(Fragment, { children: [jsx(Tooltip, { title: strings.selection, children: jsx(IconButton, { onClick: setTool("pointer" /* ToolEnum.Pointer */), children: jsx(PointerIcon, { color: iconColor("pointer" /* ToolEnum.Pointer */) }) }) }), (!hideForbiddenTools || pointEnabled) && (jsx(Tooltip, { title: strings.point, children: jsx(IconButton, { onClick: setTool("point" /* ToolEnum.Point */), disabled: !pointEnabled, children: jsx(PointIcon, { color: iconColor("point" /* ToolEnum.Point */) }) }) })), (!hideForbiddenTools || polylineEnabled) && (jsx(Tooltip, { title: strings.polyline, children: jsx(IconButton, { onClick: setTool("polyline" /* ToolEnum.Polyline */), disabled: !polylineEnabled, children: jsx(PolylineIcon, { color: iconColor("polyline" /* ToolEnum.Polyline */) }) }) })), (!hideForbiddenTools || polygonEnabled) && (jsxs(Fragment, { children: [jsx(Tooltip, { title: strings.polygon, children: jsx(IconButton, { onClick: setTool("polygon" /* ToolEnum.Polygon */), disabled: !polygonEnabled, children: jsx(PolygonIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) }) }), jsx(Tooltip, { title: strings.fullImage, children: jsx(IconButton, { onClick: handleRenderFullImagePolygon, disabled: !polygonEnabled, children: jsx(FullRoiIcon, { color: iconColor("polygon" /* ToolEnum.Polygon */) }) }) })] })), (!hideForbiddenTools || rectangleEnabled) && (jsx(Tooltip, { title: strings.rect, children: jsx(IconButton, { onClick: setTool("rect" /* ToolEnum.Rectangle */), disabled: !rectangleEnabled, children: jsx(RectangleIcon, { color: iconColor("rect" /* ToolEnum.Rectangle */) }) }) })), jsx(ColorPicker, { style: { marginLeft: 'auto', marginRight: '.5rem' } })] })) }), enableRois(configuration) && (jsx("div", { className: css('toolbar-helper', styles$1, themeMode), children: jsxs(Typography, { children: [strings[activeTool], ": ", strings["".concat(activeTool, "HelpText")]] }) }))] }));
1752
1760
  };
@@ -1855,11 +1863,12 @@ var RoiEditor = function (_a) {
1855
1863
  }, [onSubmit, configuration, shapes, metadata, prepareOutput, strings, notify, presetName, presetDescription]);
1856
1864
  log('info', enableLogs, 'react-cam-roi', 'active tool', activeTool);
1857
1865
  log('info', enableLogs, 'react-cam-roi', 'canvas size', canvasSize);
1866
+ log('info', enableLogs, 'react-cam-roi', 'image size', imageSize);
1858
1867
  log('info', enableLogs, 'react-cam-roi', 'metadata', metadata);
1859
1868
  if (!isReady) {
1860
1869
  return jsx(Loader, {});
1861
1870
  }
1862
- return (jsx(EditorProvider, { editorId: editorId, hideForbiddenTools: (_f = (_e = configuration.options) === null || _e === void 0 ? void 0 : _e.hideForbiddenTools) !== null && _f !== void 0 ? _f : false, activeTool: activeTool, setActiveTool: setActiveTool, activeColor: activeColor, setActiveColor: setActiveColor, presetName: presetName, setPresetName: setPresetName, presetDescription: presetDescription, setPresetDescription: setPresetDescription, shapes: shapes, setShapes: setShapes, addShape: addShape, addShapes: addShapes, removeShape: removeShape, configuration: configuration, metadata: metadata, setMetadata: setMetadata, onSubmit: handleSubmit, children: jsxs("div", { style: { maxWidth: '100%', width: "".concat(imageSize.width, "px") }, ref: wrapperRef, children: [jsx(TopBar, {}), configuration.rois && configuration.rois.length > 0 && (jsxs(Fragment, { children: [(slots === null || slots === void 0 ? void 0 : slots.roiAbove) && slots.roiAbove, jsxs("div", { className: css('rois-wrapper', styles$5, themeMode), children: [jsx(Header, {}), jsx(Toolbar, { canvasRef: canvasRef, imageSize: imageSize }), jsx("div", { className: css('canvas-wrapper', styles$5, themeMode), style: {
1871
+ return (jsx(EditorProvider, { editorId: editorId, hideForbiddenTools: (_f = (_e = configuration.options) === null || _e === void 0 ? void 0 : _e.hideForbiddenTools) !== null && _f !== void 0 ? _f : false, activeTool: activeTool, setActiveTool: setActiveTool, activeColor: activeColor, setActiveColor: setActiveColor, presetName: presetName, setPresetName: setPresetName, presetDescription: presetDescription, setPresetDescription: setPresetDescription, shapes: shapes, setShapes: setShapes, addShape: addShape, addShapes: addShapes, removeShape: removeShape, configuration: configuration, metadata: metadata, setMetadata: setMetadata, onSubmit: handleSubmit, children: jsxs("div", { style: { maxWidth: '100%', width: "".concat(imageSize.width, "px") }, ref: wrapperRef, children: [jsx(TopBar, {}), configuration.rois && configuration.rois.length > 0 && (jsxs(Fragment, { children: [(slots === null || slots === void 0 ? void 0 : slots.roiAbove) && slots.roiAbove, jsxs("div", { className: css('rois-wrapper', styles$5, themeMode), children: [jsx(Header, {}), jsx(Toolbar, { canvasRef: canvasRef, canvasSize: canvasSize }), jsx("div", { className: css('canvas-wrapper', styles$5, themeMode), style: {
1863
1872
  width: "".concat(canvasSize.width, "px"),
1864
1873
  height: "".concat(canvasSize.height, "px"),
1865
1874
  backgroundImage: "url(".concat(imageUrl, ")"),