cloudmr-ux 4.4.9 → 4.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.
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import "./Toolbar.css";
3
3
  import type { DrawToolkitProps } from "../draw-toolkit/DrawToolkit";
4
- /** Props for {@link DrawToolkit} minus brush controls when using {@link MroDrawToolkit}. */
5
- export type CloudMrDrawToolkitProps = Omit<DrawToolkitProps, "brushSize" | "updateBrushSize"> & {
4
+ /** Props for {@link MroDrawToolkit} extends draw toolkit with MRO pen/shape controls. */
5
+ export type CloudMrDrawToolkitProps = Omit<DrawToolkitProps, "rois" | "selectedROI" | "setSelectedROI" | "saveROI" | "labelsVisible" | "toggleLabelsVisible"> & {
6
6
  penDrawMode?: "freehand" | "polyline";
7
7
  onPenDrawModeChange?: (mode: "freehand" | "polyline") => void;
8
8
  polylineVertexCount?: number;
@@ -108,6 +108,7 @@ export var nv = new Niivue({
108
108
  penType: NI_PEN_TYPE.PEN
109
109
  });
110
110
  nv.opts.penBounds = 0;
111
+ nv.opts.penSize = 1;
111
112
  window.nv = nv;
112
113
  // The NiiVue component wraps all other components in the UI.
113
114
  // It is exported so that it can be used in other projects easily
@@ -171,15 +172,17 @@ export default function CloudMrNiivueViewer(props) {
171
172
  var _23 = useState(null), shapeDraft = _23[0], setShapeDraft = _23[1];
172
173
  var _24 = useState("freehand"), penDrawMode = _24[0], setPenDrawMode = _24[1];
173
174
  var _25 = useState(0), polylineVertexCount = _25[0], setPolylineVertexCount = _25[1];
175
+ var _26 = useState(1), brushSize = _26[0], setBrushSize = _26[1];
174
176
  var shapeDraftRef = React.useRef(null);
175
177
  var drawShapeToolRef = React.useRef(null);
176
178
  drawShapeToolRef.current = drawShapeTool;
177
179
  shapeDraftRef.current = shapeDraft;
178
180
  React.useEffect(function () {
179
181
  nv.opts.penBounds = 0;
182
+ nv.opts.penSize = 1;
180
183
  }, []);
181
- var _26 = React.useState(1.0), gamma = _26[0], setGamma = _26[1];
182
- var _27 = React.useState(0), gammaKey = _27[0], setGammaKey = _27[1];
184
+ var _27 = React.useState(1.0), gamma = _27[0], setGamma = _27[1];
185
+ var _28 = React.useState(0), gammaKey = _28[0], setGammaKey = _28[1];
183
186
  // Niivue → React bridge so other places (Toolbar) can force the UI to reset
184
187
  nv.onResetGamma = function () {
185
188
  setGamma(1.0);
@@ -224,13 +227,13 @@ export default function CloudMrNiivueViewer(props) {
224
227
  // setLayers([...nv.volumes])
225
228
  // }, [])
226
229
  // values dualslider
227
- var _28 = useState(0), rangeKey = _28[0], setRangeKey = _28[1];
230
+ var _29 = useState(0), rangeKey = _29[0], setRangeKey = _29[1];
228
231
  nv.onResetContrast = function () {
229
232
  setRangeKey(rangeKey + 1);
230
233
  };
231
- var _29 = useState([0, 0, 0]), boundMins = _29[0], setBoundMins = _29[1];
232
- var _30 = useState([1, 1, 1]), boundMaxs = _30[0], setBoundMaxs = _30[1];
233
- var _31 = useState([0.5, 0.5, 0.5]), mms = _31[0], setMMs = _31[1];
234
+ var _30 = useState([0, 0, 0]), boundMins = _30[0], setBoundMins = _30[1];
235
+ var _31 = useState([1, 1, 1]), boundMaxs = _31[0], setBoundMaxs = _31[1];
236
+ var _32 = useState([0.5, 0.5, 0.5]), mms = _32[0], setMMs = _32[1];
234
237
  nv.onImageLoaded = function () {
235
238
  var _a, _b;
236
239
  var oldCrosshairPos = __spreadArray([], nv.scene.crosshairPos, true);
@@ -513,7 +516,7 @@ export default function CloudMrNiivueViewer(props) {
513
516
  setTextsVisible(true);
514
517
  }
515
518
  }
516
- var _32 = useState("pan"), dragMode = _32[0], setDragMode = _32[1];
519
+ var _33 = useState("pan"), dragMode = _33[0], setDragMode = _33[1];
517
520
  function nvSetDragMode(dragMode) {
518
521
  switch (dragMode) {
519
522
  case "none":
@@ -550,11 +553,15 @@ export default function CloudMrNiivueViewer(props) {
550
553
  nv.setDrawingEnabled(enabled);
551
554
  nv.drawScene();
552
555
  }
556
+ function nvUpdateBrushSize(size) {
557
+ setBrushSize(size);
558
+ nv.opts.penBounds = (size - 1) / 2;
559
+ nv.opts.penSize = size;
560
+ }
553
561
  function nvUpdateDrawPen(a) {
554
562
  var raw = Number(a.target.value);
555
563
  setDrawPen(raw);
556
564
  var penValue = raw;
557
- nv.opts.penBounds = 0;
558
565
  nv.setPenValue(penValue & 7, penValue > 0);
559
566
  if (penValue == 8) {
560
567
  nv.setPenValue(0, true);
@@ -722,7 +729,7 @@ export default function CloudMrNiivueViewer(props) {
722
729
  nv.opts.crosshairWidth = w;
723
730
  nv.drawScene();
724
731
  }
725
- var _33 = useState({}), labelMapping = _33[0], setLabelMapping = _33[1];
732
+ var _34 = useState({}), labelMapping = _34[0], setLabelMapping = _34[1];
726
733
  function resampleImage(mapping) {
727
734
  if (mapping === void 0) { mapping = labelMapping; }
728
735
  var el = typeof document !== "undefined" ? document.getElementById("histoplot") : null;
@@ -832,7 +839,7 @@ export default function CloudMrNiivueViewer(props) {
832
839
  setSelectionBoxColor(__spreadArray(__spreadArray([], rgb01, true), [0.5], false));
833
840
  nv.setSelectionBoxColor(__spreadArray(__spreadArray([], rgb01, true), [0.5], false));
834
841
  }
835
- var _34 = React.useState('axial'), sliceType = _34[0], setSliceType = _34[1];
842
+ var _35 = React.useState('axial'), sliceType = _35[0], setSliceType = _35[1];
836
843
  function nvUpdateSliceType(newSliceType) {
837
844
  setSliceType(newSliceType);
838
845
  if (newSliceType === 'axial') {
@@ -972,14 +979,14 @@ export default function CloudMrNiivueViewer(props) {
972
979
  return [2 /*return*/];
973
980
  });
974
981
  }); };
975
- var _35 = useState(''), selectedROI = _35[0], setSelectedDrawingLayer = _35[1];
976
- var _36 = useState(false), saveDialogOpen = _36[0], setSaveDialogOpen = _36[1];
977
- var _37 = useState(function () {
978
- }), saveConfirmCallback = _37[0], setSaveConfirmCallback = _37[1];
979
- var _38 = useState(false), confirmationOpen = _38[0], setConfirmationOpen = _38[1];
980
- var _39 = useState(function () { }), warningConfirmationCallback = _39[0], setWarningConfirmationCallback = _39[1];
981
- var _40 = useState(function () { }), warningCancelCallback = _40[0], setWarningCancelCallback = _40[1];
982
- var _41 = useState(false), drawingChanged = _41[0], setDrawingChanged = _41[1];
982
+ var _36 = useState(''), selectedROI = _36[0], setSelectedDrawingLayer = _36[1];
983
+ var _37 = useState(false), saveDialogOpen = _37[0], setSaveDialogOpen = _37[1];
984
+ var _38 = useState(function () {
985
+ }), saveConfirmCallback = _38[0], setSaveConfirmCallback = _38[1];
986
+ var _39 = useState(false), confirmationOpen = _39[0], setConfirmationOpen = _39[1];
987
+ var _40 = useState(function () { }), warningConfirmationCallback = _40[0], setWarningConfirmationCallback = _40[1];
988
+ var _41 = useState(function () { }), warningCancelCallback = _41[0], setWarningCancelCallback = _41[1];
989
+ var _42 = useState(false), drawingChanged = _42[0], setDrawingChanged = _42[1];
983
990
  // When new drawing strokes are made on top of a saved ROI, reset the dropdown
984
991
  // so it shows the "ROI Layer" placeholder instead of the stale saved name.
985
992
  React.useEffect(function () {
@@ -1327,7 +1334,9 @@ export default function CloudMrNiivueViewer(props) {
1327
1334
  polylineVertexCount: polylineVertexCount,
1328
1335
  onCancelPolyline: cancelPolylineDraft,
1329
1336
  onFinishPolyline: finishPolylineOpen,
1330
- onCloseFillPolyline: finishPolylineClosed
1337
+ onCloseFillPolyline: finishPolylineClosed,
1338
+ brushSize: brushSize,
1339
+ updateBrushSize: nvUpdateBrushSize
1331
1340
  };
1332
1341
  return (_jsxs(Box, __assign({ sx: {
1333
1342
  display: 'flex',
@@ -0,0 +1,5 @@
1
+ export function BrushSizeSlider({ label, brushSize, updateBrushSize }: {
2
+ label: any;
3
+ brushSize: any;
4
+ updateBrushSize: any;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,36 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
13
+ import { Stack, Slider, Typography } from "@mui/material";
14
+ var SLIDER_SX = {
15
+ width: "80%",
16
+ color: "#fff",
17
+ "& .MuiSlider-track": { backgroundColor: "#fff", border: "none" },
18
+ "& .MuiSlider-rail": { backgroundColor: "rgba(255,255,255,0.3)" },
19
+ "& .MuiSlider-thumb": {
20
+ backgroundColor: "#fff",
21
+ border: "2px solid #fff",
22
+ "&:hover, &.Mui-focusVisible, &.Mui-active": {
23
+ boxShadow: "0 0 0 8px rgba(255,255,255,0.16)"
24
+ }
25
+ },
26
+ "& .MuiSlider-mark": { backgroundColor: "#fff" },
27
+ "& .MuiSlider-markActive": { backgroundColor: "#fff" },
28
+ "& .MuiSlider-valueLabel": {
29
+ backgroundColor: "#fff",
30
+ color: "#000"
31
+ }
32
+ };
33
+ export function BrushSizeSlider(_a) {
34
+ var label = _a.label, brushSize = _a.brushSize, updateBrushSize = _a.updateBrushSize;
35
+ return (_jsxs(Stack, __assign({ sx: { mb: 0.5, px: 0.5 }, alignItems: "center", width: "100%" }, { children: [_jsxs(Typography, __assign({ color: "white", noWrap: true, width: "100%", marginLeft: "6pt", fontSize: "11pt", sx: { userSelect: "none" } }, { children: [label, ": ", brushSize] })), _jsx(Slider, { value: brushSize, sx: SLIDER_SX, step: 2, min: 1, max: 15, marks: true, onChange: function (_event, value) { return updateBrushSize(value); } })] })));
36
+ }
@@ -1,4 +1,4 @@
1
- export default function DrawColorPlatte({ expanded, updateDrawPen, setDrawingEnabled, showPenModes, penDrawMode, onPenDrawModeChange, polylineVertexCount, onCancelPolyline, onFinishPolyline, onCloseFillPolyline, shapeDraftActive, onApplyShapeDraft, onCancelShapeDraft, }: {
1
+ export default function DrawColorPlatte({ expanded, updateDrawPen, setDrawingEnabled, showPenModes, penDrawMode, onPenDrawModeChange, polylineVertexCount, onCancelPolyline, onFinishPolyline, onCloseFillPolyline, brushSize, updateBrushSize, shapeDraftActive, onApplyShapeDraft, onCancelShapeDraft, }: {
2
2
  expanded: any;
3
3
  updateDrawPen: any;
4
4
  setDrawingEnabled: any;
@@ -9,6 +9,8 @@ export default function DrawColorPlatte({ expanded, updateDrawPen, setDrawingEna
9
9
  onCancelPolyline: any;
10
10
  onFinishPolyline: any;
11
11
  onCloseFillPolyline: any;
12
+ brushSize?: number | undefined;
13
+ updateBrushSize: any;
12
14
  shapeDraftActive?: boolean | undefined;
13
15
  onApplyShapeDraft: any;
14
16
  onCancelShapeDraft: any;
@@ -18,6 +18,7 @@ import { Stack, IconButton, Button, Tooltip, Typography } from "@mui/material";
18
18
  import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord";
19
19
  import CheckIcon from "@mui/icons-material/Check";
20
20
  import CloseIcon from "@mui/icons-material/Close";
21
+ import { BrushSizeSlider } from "./BrushSizeSlider";
21
22
  var FILLED_COLORS = [
22
23
  { sx: { color: "red" } },
23
24
  { sx: { color: "green" } },
@@ -37,7 +38,7 @@ var modeBtnSx = function (active) { return ({
37
38
  px: 0.75
38
39
  }); };
39
40
  export default function DrawColorPlatte(_a) {
40
- var expanded = _a.expanded, updateDrawPen = _a.updateDrawPen, setDrawingEnabled = _a.setDrawingEnabled, _b = _a.showPenModes, showPenModes = _b === void 0 ? false : _b, _c = _a.penDrawMode, penDrawMode = _c === void 0 ? "freehand" : _c, onPenDrawModeChange = _a.onPenDrawModeChange, _d = _a.polylineVertexCount, polylineVertexCount = _d === void 0 ? 0 : _d, onCancelPolyline = _a.onCancelPolyline, onFinishPolyline = _a.onFinishPolyline, onCloseFillPolyline = _a.onCloseFillPolyline, _e = _a.shapeDraftActive, shapeDraftActive = _e === void 0 ? false : _e, onApplyShapeDraft = _a.onApplyShapeDraft, onCancelShapeDraft = _a.onCancelShapeDraft;
41
+ var expanded = _a.expanded, updateDrawPen = _a.updateDrawPen, setDrawingEnabled = _a.setDrawingEnabled, _b = _a.showPenModes, showPenModes = _b === void 0 ? false : _b, _c = _a.penDrawMode, penDrawMode = _c === void 0 ? "freehand" : _c, onPenDrawModeChange = _a.onPenDrawModeChange, _d = _a.polylineVertexCount, polylineVertexCount = _d === void 0 ? 0 : _d, onCancelPolyline = _a.onCancelPolyline, onFinishPolyline = _a.onFinishPolyline, onCloseFillPolyline = _a.onCloseFillPolyline, _e = _a.brushSize, brushSize = _e === void 0 ? 1 : _e, updateBrushSize = _a.updateBrushSize, _f = _a.shapeDraftActive, shapeDraftActive = _f === void 0 ? false : _f, onApplyShapeDraft = _a.onApplyShapeDraft, onCancelShapeDraft = _a.onCancelShapeDraft;
41
42
  return (_jsxs(Stack, __assign({ style: {
42
43
  position: "absolute",
43
44
  top: "100%",
@@ -51,7 +52,7 @@ export default function DrawColorPlatte(_a) {
51
52
  borderTopLeftRadius: "6pt",
52
53
  borderTopRightRadius: "6pt",
53
54
  background: "#333"
54
- }, direction: "column", spacing: 0.5, sx: { py: expanded ? 0.5 : 0 } }, { children: [showPenModes && expanded && (_jsxs(Stack, __assign({ direction: "row", alignItems: "center", spacing: 0.5, sx: { px: 0.75, pt: 0.25 } }, { children: [_jsx(Button, __assign({ size: "small", onClick: function () { return onPenDrawModeChange === null || onPenDrawModeChange === void 0 ? void 0 : onPenDrawModeChange("freehand"); }, sx: modeBtnSx(penDrawMode === "freehand") }, { children: "Freehand" })), _jsx(Button, __assign({ size: "small", onClick: function () { return onPenDrawModeChange === null || onPenDrawModeChange === void 0 ? void 0 : onPenDrawModeChange("polyline"); }, sx: modeBtnSx(penDrawMode === "polyline") }, { children: "Straight lines" }))] }))), _jsx(Stack, __assign({ direction: "row" }, { children: FILLED_COLORS.map(function (color, index) { return (_jsx(IconButton, __assign({ onClick: function () {
55
+ }, direction: "column", spacing: 0.5, sx: { py: expanded ? 0.5 : 0 } }, { children: [showPenModes && expanded && (_jsxs(Stack, __assign({ direction: "row", alignItems: "center", spacing: 0.5, sx: { px: 0.75, pt: 0.25 } }, { children: [_jsx(Button, __assign({ size: "small", onClick: function () { return onPenDrawModeChange === null || onPenDrawModeChange === void 0 ? void 0 : onPenDrawModeChange("freehand"); }, sx: modeBtnSx(penDrawMode === "freehand") }, { children: "Freehand" })), _jsx(Button, __assign({ size: "small", onClick: function () { return onPenDrawModeChange === null || onPenDrawModeChange === void 0 ? void 0 : onPenDrawModeChange("polyline"); }, sx: modeBtnSx(penDrawMode === "polyline") }, { children: "Straight lines" }))] }))), showPenModes && expanded && updateBrushSize && (_jsx(BrushSizeSlider, { label: "Line thickness", brushSize: brushSize, updateBrushSize: updateBrushSize })), _jsx(Stack, __assign({ direction: "row" }, { children: FILLED_COLORS.map(function (color, index) { return (_jsx(IconButton, __assign({ onClick: function () {
55
56
  updateDrawPen({ target: { value: index + 1 } });
56
57
  setDrawingEnabled(true);
57
58
  } }, { children: _jsx(FiberManualRecordIcon, { sx: color.sx }) }), index)); }) })), showPenModes && penDrawMode === "polyline" && expanded && polylineVertexCount === 0 && (_jsx(Typography, __assign({ sx: { px: 1, pb: 0.5, fontSize: "0.68rem", color: "#aaa", userSelect: "none" } }, { children: "Click each corner to draw connected straight lines" }))), showPenModes && penDrawMode === "polyline" && expanded && polylineVertexCount >= 2 && (_jsxs(Stack, __assign({ direction: "row", alignItems: "center", justifyContent: "space-between", sx: { px: 1, py: 0.5, borderTop: "1px solid #555", width: "100%" } }, { children: [_jsx(Tooltip, __assign({ title: "Discard current outline" }, { children: _jsx(Button, __assign({ size: "small", "aria-label": "cancel polyline", onClick: function () { return onCancelPolyline === null || onCancelPolyline === void 0 ? void 0 : onCancelPolyline(); }, startIcon: _jsx(CloseIcon, { sx: { fontSize: ACTION_ICON_SIZE } }), sx: {
@@ -1,2 +1,7 @@
1
- export default EraserPlatte;
2
- declare function EraserPlatte(_a: any): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
1
+ export default function EraserPlatte({ expandEraseOptions, updateDrawPen, setDrawingEnabled, brushSize, updateBrushSize, }: {
2
+ expandEraseOptions: any;
3
+ updateDrawPen: any;
4
+ setDrawingEnabled: any;
5
+ brushSize?: number | undefined;
6
+ updateBrushSize: any;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,29 +1,26 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { Stack, IconButton } from "@mui/material";
3
14
  import FiberManualRecordIcon from "@mui/icons-material/FiberManualRecord";
4
15
  import FiberManualRecordOutlinedIcon from "@mui/icons-material/FiberManualRecordOutlined";
5
- var __assign = function () {
6
- __assign =
7
- Object.assign ||
8
- function (t) {
9
- for (var s, i = 1, n = arguments.length; i < n; i++) {
10
- s = arguments[i];
11
- for (var p in s)
12
- if (Object.prototype.hasOwnProperty.call(s, p))
13
- t[p] = s[p];
14
- }
15
- return t;
16
- };
17
- return __assign.apply(this, arguments);
18
- };
19
- var EraserPlatte = function (_a) {
20
- var expandEraseOptions = _a.expandEraseOptions, updateDrawPen = _a.updateDrawPen, setDrawingEnabled = _a.setDrawingEnabled;
16
+ import { BrushSizeSlider } from "./BrushSizeSlider";
17
+ export default function EraserPlatte(_a) {
18
+ var expandEraseOptions = _a.expandEraseOptions, updateDrawPen = _a.updateDrawPen, setDrawingEnabled = _a.setDrawingEnabled, _b = _a.brushSize, brushSize = _b === void 0 ? 1 : _b, updateBrushSize = _a.updateBrushSize;
21
19
  var eraseOptions = [
22
20
  _jsx(FiberManualRecordIcon, { style: { color: "white" } }, "e0"),
23
21
  _jsx(FiberManualRecordOutlinedIcon, { style: { color: "white" } }, "e1"),
24
22
  ];
25
- return _jsxs(Stack, __assign({
26
- style: {
23
+ return (_jsxs(Stack, __assign({ style: {
27
24
  position: "absolute",
28
25
  top: "100%",
29
26
  left: 0,
@@ -36,21 +33,8 @@ var EraserPlatte = function (_a) {
36
33
  borderTopRightRadius: "6pt",
37
34
  background: "#333",
38
35
  width: 150
39
- },
40
- direction: "column"
41
- }, {
42
- children: [
43
- _jsx(Stack, __assign({ direction: "row", style: { justifyContent: "center" } }, {
44
- children: eraseOptions.map(function (value, index) {
45
- return _jsx(IconButton, __assign({
46
- onClick: function () {
47
- updateDrawPen({ target: { value: index === 0 ? 8 : 0 } });
48
- setDrawingEnabled(true);
49
- }
50
- }, { children: value }), index);
51
- })
52
- })),
53
- ]
54
- }));
55
- };
56
- export default EraserPlatte;
36
+ }, direction: "column" }, { children: [updateBrushSize && (_jsx(BrushSizeSlider, { label: "Eraser size", brushSize: brushSize, updateBrushSize: updateBrushSize })), _jsx(Stack, __assign({ direction: "row", style: { justifyContent: "center" } }, { children: eraseOptions.map(function (value, index) { return (_jsx(IconButton, __assign({ onClick: function () {
37
+ updateDrawPen({ target: { value: index === 0 ? 8 : 0 } });
38
+ setDrawingEnabled(true);
39
+ } }, { children: value }), index)); }) }))] })));
40
+ }
@@ -170,7 +170,7 @@ export function MroDrawToolkit(props) {
170
170
  alignItems: "center",
171
171
  gap: 4,
172
172
  overflow: "visible"
173
- } }, { children: [_jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "d" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Pen" }, { children: _jsx(IconButton, __assign({ "aria-label": "pen", size: "small", onClick: clickPen, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("pen")) }, { children: _jsx(DrawIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "d", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, showPenModes: true, penDrawMode: props.penDrawMode, onPenDrawModeChange: props.onPenDrawModeChange, polylineVertexCount: props.polylineVertexCount, onCancelPolyline: props.onCancelPolyline, onFinishPolyline: props.onFinishPolyline, onCloseFillPolyline: props.onCloseFillPolyline })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "r" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Rectangle" }, { children: _jsx(IconButton, __assign({ "aria-label": "rectangle", size: "small", onClick: clickRectangle, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("rectangle")) }, { children: _jsx(CropSquareOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "r", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "rectangle", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "l" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Ellipse" }, { children: _jsx(IconButton, __assign({ "aria-label": "ellipse", size: "small", onClick: clickEllipse, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("ellipse")) }, { children: _jsx(CircleOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "l", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "ellipse", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "e" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Eraser" }, { children: _jsx(IconButton, __assign({ "aria-label": "erase", size: "small", onClick: clickEraser, sx: toolBtnSx }, { children: filled || expandedOption !== "e" ? (_jsx(EraserIcon, {})) : (_jsx(AutoFixNormalOutlinedIcon, { sx: { color: ICON_COLOR } })) })) })), _jsx(EraserPlatte, { expandEraseOptions: expandedOption === "e", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled })] })), _jsx(Tooltip, __assign({ title: "Undo" }, { children: _jsx(IconButton, __assign({ "aria-label": "revert", size: "small", onClick: function () { return props.drawUndo(); }, sx: toolBtnSx }, { children: _jsx(ReplyIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "Save screenshot" }, { children: _jsx("span", { children: _jsx(IconButton, __assign({ "aria-label": "capture", size: "small", disabled: !vol, onClick: function () { return vol && props.nv.saveScene("".concat(vol.name, "_drawing.png")); }, sx: toolBtnSx }, { children: _jsx(CameraAltIcon, { sx: { color: ICON_COLOR } }) })) }) })), _jsx(Tooltip, __assign({ title: "Clear drawing" }, { children: _jsx(IconButton, __assign({ "aria-label": "delete", size: "small", onClick: function () {
173
+ } }, { children: [_jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "d" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Pen" }, { children: _jsx(IconButton, __assign({ "aria-label": "pen", size: "small", onClick: clickPen, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("pen")) }, { children: _jsx(DrawIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "d", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, showPenModes: true, penDrawMode: props.penDrawMode, onPenDrawModeChange: props.onPenDrawModeChange, polylineVertexCount: props.polylineVertexCount, onCancelPolyline: props.onCancelPolyline, onFinishPolyline: props.onFinishPolyline, onCloseFillPolyline: props.onCloseFillPolyline, brushSize: props.brushSize, updateBrushSize: props.updateBrushSize })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "r" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Rectangle" }, { children: _jsx(IconButton, __assign({ "aria-label": "rectangle", size: "small", onClick: clickRectangle, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("rectangle")) }, { children: _jsx(CropSquareOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "r", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "rectangle", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "l" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Ellipse" }, { children: _jsx(IconButton, __assign({ "aria-label": "ellipse", size: "small", onClick: clickEllipse, sx: __assign(__assign({}, toolBtnSx), shapeSelectedSx("ellipse")) }, { children: _jsx(CircleOutlinedIcon, { sx: { color: "inherit" } }) })) })), _jsx(DrawColorPlatte, { expanded: expandedOption === "l", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, shapeDraftActive: props.shapeDraftActive && drawShapeTool === "ellipse", onApplyShapeDraft: props.onApplyShapeDraft, onCancelShapeDraft: props.onCancelShapeDraft })] })), _jsxs(Box, __assign({ sx: { position: "relative", zIndex: expandedOption === "e" ? 1600 : "auto", display: "inline-flex", alignItems: "center" } }, { children: [_jsx(Tooltip, __assign({ title: "Eraser" }, { children: _jsx(IconButton, __assign({ "aria-label": "erase", size: "small", onClick: clickEraser, sx: toolBtnSx }, { children: filled || expandedOption !== "e" ? (_jsx(EraserIcon, {})) : (_jsx(AutoFixNormalOutlinedIcon, { sx: { color: ICON_COLOR } })) })) })), _jsx(EraserPlatte, { expandEraseOptions: expandedOption === "e", updateDrawPen: props.updateDrawPen, setDrawingEnabled: props.setDrawingEnabled, brushSize: props.brushSize, updateBrushSize: props.updateBrushSize })] })), _jsx(Tooltip, __assign({ title: "Undo" }, { children: _jsx(IconButton, __assign({ "aria-label": "revert", size: "small", onClick: function () { return props.drawUndo(); }, sx: toolBtnSx }, { children: _jsx(ReplyIcon, { sx: { color: ICON_COLOR } }) })) })), _jsx(Tooltip, __assign({ title: "Save screenshot" }, { children: _jsx("span", { children: _jsx(IconButton, __assign({ "aria-label": "capture", size: "small", disabled: !vol, onClick: function () { return vol && props.nv.saveScene("".concat(vol.name, "_drawing.png")); }, sx: toolBtnSx }, { children: _jsx(CameraAltIcon, { sx: { color: ICON_COLOR } }) })) }) })), _jsx(Tooltip, __assign({ title: "Clear drawing" }, { children: _jsx(IconButton, __assign({ "aria-label": "delete", size: "small", onClick: function () {
174
174
  props.nv.clearDrawing();
175
175
  props.resampleImage();
176
176
  props.setDrawingChanged(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.4.9",
3
+ "version": "4.5.0",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",