cloudmr-ux 4.5.5 → 4.5.8
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/CmrComponents/niivue-viewer/CloudMrNiivueViewer.js +56 -3
- package/dist/CmrComponents/niivue-viewer/ShapeDraftOverlay.js +3 -2
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/DrawColorPlatte.js +2 -2
- package/dist/CmrComponents/niivue-viewer/mro-draw-toolkit/MroDrawToolkit.js +2 -0
- package/dist/CmrComponents/niivue-viewer/penDraftUtils.d.ts +1 -0
- package/dist/CmrComponents/niivue-viewer/penDraftUtils.js +7 -1
- package/dist/CmrComponents/niivue-viewer/polylinePenUtils.js +2 -1
- package/package.json +1 -1
|
@@ -565,13 +565,37 @@ export default function CloudMrNiivueViewer(props) {
|
|
|
565
565
|
nv.opts.penSize = size;
|
|
566
566
|
}
|
|
567
567
|
function nvUpdateDrawPen(a) {
|
|
568
|
+
var _a;
|
|
568
569
|
var raw = Number(a.target.value);
|
|
569
570
|
setDrawPen(raw);
|
|
570
|
-
var
|
|
571
|
-
|
|
572
|
-
if (penValue == 8) {
|
|
571
|
+
var isEraser = raw === 0 || raw === 8;
|
|
572
|
+
if (raw === 8) {
|
|
573
573
|
nv.setPenValue(0, true);
|
|
574
574
|
}
|
|
575
|
+
else {
|
|
576
|
+
nv.setPenValue(raw & 7, raw > 0);
|
|
577
|
+
}
|
|
578
|
+
if (isEraser) {
|
|
579
|
+
nv.opts.deferFreehandCommit = false;
|
|
580
|
+
nv.opts.deferShapeCommit = false;
|
|
581
|
+
nv.opts.polylinePenMode = false;
|
|
582
|
+
(_a = nv.cloudMrResetPolyline) === null || _a === void 0 ? void 0 : _a.call(nv);
|
|
583
|
+
if (penDraftRef.current) {
|
|
584
|
+
cancelPenDraft(nv, penDraftRef.current);
|
|
585
|
+
setPenDraft(null);
|
|
586
|
+
penDraftRef.current = null;
|
|
587
|
+
nv._cloudMrPenDraftActive = false;
|
|
588
|
+
setPolylineVertexCount(0);
|
|
589
|
+
}
|
|
590
|
+
if (shapeDraftRef.current) {
|
|
591
|
+
cancelShapeDraft();
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
else if (drawShapeToolRef.current === "pen") {
|
|
595
|
+
nv.opts.deferFreehandCommit = penDrawModeRef.current === "freehand";
|
|
596
|
+
nv.opts.polylinePenMode = penDrawModeRef.current === "polyline";
|
|
597
|
+
nv.opts.isFilledPen = penDrawModeRef.current === "freehand";
|
|
598
|
+
}
|
|
575
599
|
}
|
|
576
600
|
function nvUpdateDrawOpacity(a) {
|
|
577
601
|
setDrawOpacity(a);
|
|
@@ -886,6 +910,35 @@ export default function CloudMrNiivueViewer(props) {
|
|
|
886
910
|
React.useEffect(function () {
|
|
887
911
|
nv._cloudMrPenDraftActive = penDraft != null;
|
|
888
912
|
}, [penDraft]);
|
|
913
|
+
React.useEffect(function () {
|
|
914
|
+
nv._cloudMrShapeDraftActive = shapeDraft != null;
|
|
915
|
+
}, [shapeDraft]);
|
|
916
|
+
React.useEffect(function () {
|
|
917
|
+
if (!shapeDraft && !penDraft) {
|
|
918
|
+
return undefined;
|
|
919
|
+
}
|
|
920
|
+
var canvas = document.getElementById("niiCanvas");
|
|
921
|
+
if (!canvas) {
|
|
922
|
+
return undefined;
|
|
923
|
+
}
|
|
924
|
+
var applyOnRightClick = function (event) {
|
|
925
|
+
var _a;
|
|
926
|
+
event.preventDefault();
|
|
927
|
+
event.stopPropagation();
|
|
928
|
+
(_a = nv.onApplyActiveDraft) === null || _a === void 0 ? void 0 : _a.call(nv);
|
|
929
|
+
};
|
|
930
|
+
var onMouseDown = function (event) {
|
|
931
|
+
if (event.button === 2) {
|
|
932
|
+
applyOnRightClick(event);
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
canvas.addEventListener("mousedown", onMouseDown, true);
|
|
936
|
+
canvas.addEventListener("contextmenu", applyOnRightClick, true);
|
|
937
|
+
return function () {
|
|
938
|
+
canvas.removeEventListener("mousedown", onMouseDown, true);
|
|
939
|
+
canvas.removeEventListener("contextmenu", applyOnRightClick, true);
|
|
940
|
+
};
|
|
941
|
+
}, [shapeDraft, penDraft]);
|
|
889
942
|
React.useEffect(function () {
|
|
890
943
|
if (!shapeDraft && !penDraft) {
|
|
891
944
|
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: "
|
|
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 (
|
|
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 (
|
|
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",
|
|
@@ -122,10 +122,12 @@ export function MroDrawToolkit(props) {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
function clickEraser() {
|
|
125
|
+
var _a;
|
|
125
126
|
if (expandedOption === "e") {
|
|
126
127
|
setExpandedOption("n");
|
|
127
128
|
}
|
|
128
129
|
else {
|
|
130
|
+
(_a = props.onExitDrawMode) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
129
131
|
props.updateDrawPen({ target: { value: 8 } });
|
|
130
132
|
setExpandedOption("e");
|
|
131
133
|
}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* @property {{ x1: number, y1: number, x2: number, y2: number, z1: number, z2: number }} [bounds]
|
|
11
11
|
* @property {boolean} [filled]
|
|
12
12
|
*/
|
|
13
|
+
export function isEraserActive(nv: any): any;
|
|
13
14
|
export function isFreehandPenActive(nv: any): any;
|
|
14
15
|
export function shouldDeferFreehandCommit(nv: any): any;
|
|
15
16
|
export function redrawPolylineDraft(nv: any, draft: any): void;
|
|
@@ -32,11 +32,17 @@ import { NI_PEN_TYPE } from "./niivuePenType";
|
|
|
32
32
|
* @property {{ x1: number, y1: number, x2: number, y2: number, z1: number, z2: number }} [bounds]
|
|
33
33
|
* @property {boolean} [filled]
|
|
34
34
|
*/
|
|
35
|
+
export function isEraserActive(nv) {
|
|
36
|
+
return (nv.opts.drawingEnabled &&
|
|
37
|
+
nv.opts.penType === NI_PEN_TYPE.PEN &&
|
|
38
|
+
nv.opts.penValue === 0);
|
|
39
|
+
}
|
|
35
40
|
export function isFreehandPenActive(nv) {
|
|
36
41
|
return (nv.opts.isFilledPen &&
|
|
37
42
|
nv.opts.drawingEnabled &&
|
|
38
43
|
nv.opts.penType === NI_PEN_TYPE.PEN &&
|
|
39
|
-
!nv.opts.polylinePenMode
|
|
44
|
+
!nv.opts.polylinePenMode &&
|
|
45
|
+
nv.opts.penValue > 0);
|
|
40
46
|
}
|
|
41
47
|
export function shouldDeferFreehandCommit(nv) {
|
|
42
48
|
return !!nv.opts.deferFreehandCommit && isFreehandPenActive(nv);
|
|
@@ -12,7 +12,8 @@ var CLICK_DRAG_PX = 5;
|
|
|
12
12
|
export function isPolylinePenActive(nv) {
|
|
13
13
|
return (nv.opts.polylinePenMode &&
|
|
14
14
|
nv.opts.drawingEnabled &&
|
|
15
|
-
nv.opts.penType === NI_PEN_TYPE.PEN
|
|
15
|
+
nv.opts.penType === NI_PEN_TYPE.PEN &&
|
|
16
|
+
nv.opts.penValue > 0);
|
|
16
17
|
}
|
|
17
18
|
export function isClickWithoutDrag(uiData, thresholdPx) {
|
|
18
19
|
if (thresholdPx === void 0) { thresholdPx = CLICK_DRAG_PX; }
|