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