cloudmr-ux 4.5.5 → 4.5.6

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.
@@ -886,6 +886,35 @@ export default function CloudMrNiivueViewer(props) {
886
886
  React.useEffect(function () {
887
887
  nv._cloudMrPenDraftActive = penDraft != null;
888
888
  }, [penDraft]);
889
+ React.useEffect(function () {
890
+ nv._cloudMrShapeDraftActive = shapeDraft != null;
891
+ }, [shapeDraft]);
892
+ React.useEffect(function () {
893
+ if (!shapeDraft && !penDraft) {
894
+ return undefined;
895
+ }
896
+ var canvas = document.getElementById("niiCanvas");
897
+ if (!canvas) {
898
+ return undefined;
899
+ }
900
+ var applyOnRightClick = function (event) {
901
+ var _a;
902
+ event.preventDefault();
903
+ event.stopPropagation();
904
+ (_a = nv.onApplyActiveDraft) === null || _a === void 0 ? void 0 : _a.call(nv);
905
+ };
906
+ var onMouseDown = function (event) {
907
+ if (event.button === 2) {
908
+ applyOnRightClick(event);
909
+ }
910
+ };
911
+ canvas.addEventListener("mousedown", onMouseDown, true);
912
+ canvas.addEventListener("contextmenu", applyOnRightClick, true);
913
+ return function () {
914
+ canvas.removeEventListener("mousedown", onMouseDown, true);
915
+ canvas.removeEventListener("contextmenu", applyOnRightClick, true);
916
+ };
917
+ }, [shapeDraft, penDraft]);
889
918
  React.useEffect(function () {
890
919
  if (!shapeDraft && !penDraft) {
891
920
  return undefined;
@@ -152,13 +152,14 @@ export function ShapeDraftOverlay(_a) {
152
152
  boxSizing: "border-box",
153
153
  cursor: "pointer",
154
154
  zIndex: 3,
155
- touchAction: "none"
155
+ touchAction: "none",
156
+ pointerEvents: "auto"
156
157
  };
157
158
  return (_jsxs("div", __assign({ style: {
158
159
  position: "absolute",
159
160
  inset: 0,
160
161
  zIndex: 2,
161
- pointerEvents: "auto",
162
+ pointerEvents: "none",
162
163
  overflow: "hidden"
163
164
  }, "aria-label": "Adjust ROI shape" }, { children: [_jsx("div", { style: {
164
165
  position: "absolute",
@@ -69,7 +69,7 @@ export default function DrawColorPlatte(_a) {
69
69
  minWidth: 0,
70
70
  py: 0.25,
71
71
  px: 0.75
72
- } }, { children: "Fill" })) }))), _jsx(Tooltip, __assign({ title: "Apply (Enter or right-click)" }, { children: _jsx(Button, __assign({ size: "small", "aria-label": "apply pen draft", onClick: function () { return onApplyPenDraft === null || onApplyPenDraft === void 0 ? void 0 : onApplyPenDraft(); }, startIcon: _jsx(CheckIcon, { sx: { fontSize: ACTION_ICON_SIZE } }), sx: {
72
+ } }, { children: "Fill" })) }))), _jsx(Tooltip, __assign({ title: "Apply shape (enter or right-click)" }, { children: _jsx(Button, __assign({ size: "small", "aria-label": "apply pen draft", onClick: function () { return onApplyPenDraft === null || onApplyPenDraft === void 0 ? void 0 : onApplyPenDraft(); }, startIcon: _jsx(CheckIcon, { sx: { fontSize: ACTION_ICON_SIZE } }), sx: {
73
73
  color: "#c9a0e8",
74
74
  fontSize: ACTION_FONT_SIZE,
75
75
  textTransform: "none",
@@ -85,7 +85,7 @@ export default function DrawColorPlatte(_a) {
85
85
  py: 0.25,
86
86
  px: 0.75,
87
87
  "& .MuiButton-startIcon": { mr: 0.5, ml: 0 }
88
- } }, { children: "Cancel" })) })), _jsx(Tooltip, __assign({ title: "Apply shape (Enter or right-click)" }, { children: _jsx(Button, __assign({ size: "small", "aria-label": "apply shape", onClick: function () { return onApplyShapeDraft === null || onApplyShapeDraft === void 0 ? void 0 : onApplyShapeDraft(); }, startIcon: _jsx(CheckIcon, { sx: { fontSize: ACTION_ICON_SIZE } }), sx: {
88
+ } }, { children: "Cancel" })) })), _jsx(Tooltip, __assign({ title: "Apply shape (enter or right-click)" }, { children: _jsx(Button, __assign({ size: "small", "aria-label": "apply shape", onClick: function () { return onApplyShapeDraft === null || onApplyShapeDraft === void 0 ? void 0 : onApplyShapeDraft(); }, startIcon: _jsx(CheckIcon, { sx: { fontSize: ACTION_ICON_SIZE } }), sx: {
89
89
  color: "#c9a0e8",
90
90
  fontSize: ACTION_FONT_SIZE,
91
91
  textTransform: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.5.5",
3
+ "version": "4.5.6",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",