cloudmr-ux 4.6.6 → 4.6.7

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.
@@ -932,9 +932,11 @@ export default function CloudMrNiivueViewer(props) {
932
932
  setShapeDraft(null);
933
933
  shapeDraftRef.current = null;
934
934
  nv._cloudMrShapeDraftActive = false;
935
- if (drawShapeToolRef.current) {
936
- nvSetDrawingEnabled(true);
937
- }
935
+ // Deactivate tool entirely — palette closes, user re-enters edit by clicking the ROI
936
+ setDrawShapeTool(null);
937
+ nv.opts.deferShapeCommit = false;
938
+ nv.opts.penType = NI_PEN_TYPE.PEN;
939
+ nvSetDrawingEnabled(false);
938
940
  resampleImage();
939
941
  }
940
942
  function onShapeDraftChange(draft) {
@@ -945,6 +947,11 @@ export default function CloudMrNiivueViewer(props) {
945
947
  setShapeDraft(draft);
946
948
  shapeDraftRef.current = draft;
947
949
  nv._cloudMrShapeDraftActive = true;
950
+ // Auto-select the correct tool so the palette opens on re-entry via ROI click
951
+ var tool = draft.penType === NI_PEN_TYPE.ELLIPSE ? "ellipse" : "rectangle";
952
+ setDrawShapeTool(tool);
953
+ nv.opts.penType = draft.penType;
954
+ nv.opts.deferShapeCommit = true;
948
955
  nvSetDrawingEnabled(false);
949
956
  };
950
957
  nv.onApplyActiveDraft = function () {
@@ -1488,17 +1488,14 @@ function cloudMrTryApplyDraftOnRightClick(nv, event) {
1488
1488
 
1489
1489
  /**
1490
1490
  * Re-enter rectangle/ellipse edit mode when clicking an existing applied ROI.
1491
+ * Works regardless of which tool is currently active (or whether any tool is active),
1492
+ * so clicking an ROI after apply always re-enters edit mode.
1491
1493
  */
1492
1494
  function cloudMrTryReopenShapeDraftOnClick(nv) {
1493
- const penType = nv.opts.penType;
1494
- if (
1495
- !nv.opts.deferShapeCommit ||
1496
- !nv.opts.drawingEnabled ||
1497
- nv._cloudMrShapeDraftActive ||
1498
- nv._cloudMrPenDraftActive ||
1499
- !isClickWithoutDrag(nv.uiData) ||
1500
- (penType !== NI_PEN_TYPE.RECTANGLE && penType !== NI_PEN_TYPE.ELLIPSE)
1501
- ) {
1495
+ if (nv._cloudMrShapeDraftActive || nv._cloudMrPenDraftActive) {
1496
+ return false;
1497
+ }
1498
+ if (!isClickWithoutDrag(nv.uiData)) {
1502
1499
  return false;
1503
1500
  }
1504
1501
 
@@ -71,6 +71,11 @@ export function MroDrawToolkit(props) {
71
71
  var _d = useState(undefined), setMaskColor = _d[1];
72
72
  var filled = props.drawPen > 7;
73
73
  useEffect(function () {
74
+ // Close palette when tool is deactivated programmatically (e.g. after Apply)
75
+ if (drawShapeTool === null && !props.shapeDraftActive && !props.penDraftActive) {
76
+ setExpandedOption("n");
77
+ return;
78
+ }
74
79
  if (!props.shapeDraftActive && !props.penDraftActive)
75
80
  return;
76
81
  if (drawShapeTool === "rectangle")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.6.6",
3
+ "version": "4.6.7",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",