cloudmr-ux 4.9.0 → 5.0.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.
@@ -10,7 +10,8 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { Card, CardContent, Box } from "@mui/material";
13
+ import { Box, Button, Card, CardContent } from "@mui/material";
14
+ import Brightness6Icon from "@mui/icons-material/Brightness6";
14
15
  import TKDualRange from "../tk-dualrange/TKDualRange";
15
16
  import CmrLabel from "../label/Label";
16
17
  import { resolveNiivueAccentColor, useNiivueViewerTheme, } from "../niivue-viewer/NiivueViewerThemeContext";
@@ -52,6 +53,43 @@ export function NiivueContrastAdjustments(_a) {
52
53
  var theme = useNiivueViewerTheme();
53
54
  var accentColor = resolveNiivueAccentColor(accentColorProp, theme);
54
55
  var a = transformFactors.a, b = transformFactors.b;
56
+ var handleResetContrast = function () {
57
+ var _a, _b;
58
+ nv.resetContrast();
59
+ nv.setGamma(1.0);
60
+ (_a = nv.onResetGamma) === null || _a === void 0 ? void 0 : _a.call(nv);
61
+ var vol = (_b = nv.volumes) === null || _b === void 0 ? void 0 : _b[0];
62
+ if (vol) {
63
+ setMin(vol.cal_min);
64
+ setMax(vol.cal_max);
65
+ }
66
+ };
67
+ var resetContrastButtonSx = {
68
+ color: "rgba(0, 0, 0, 0.87)",
69
+ textTransform: "none",
70
+ fontSize: "0.78rem",
71
+ py: 0,
72
+ minWidth: 0,
73
+ background: "none",
74
+ "& .MuiButton-startIcon": {
75
+ color: "inherit"
76
+ },
77
+ "&:hover": {
78
+ color: accentColor,
79
+ background: "none"
80
+ },
81
+ "&:active": {
82
+ color: accentColor,
83
+ opacity: 0.8,
84
+ background: "none"
85
+ },
86
+ "&:focus": {
87
+ background: "none"
88
+ },
89
+ "&.MuiButtonBase-root:hover": {
90
+ backgroundColor: "transparent"
91
+ }
92
+ };
55
93
  return (_jsxs("div", __assign({ style: style, className: className }, { children: [title !== "" && (_jsx("div", __assign({ className: "title", style: { width: "100%" } }, { children: title }))), _jsx(Card, __assign({ variant: "outlined", sx: { mb: 2, borderTopLeftRadius: 0, borderTopRightRadius: 0 } }, { children: _jsx(CardContent, __assign({ sx: { "&:last-child": { paddingBottom: 2 } } }, { children: _jsxs(Box, __assign({ style: { display: "flex", flex: 1, minWidth: "245px", flexDirection: "column" } }, { children: [_jsx(TKDualRange, { name: "Values:", minDomain: (_c = (_b = nv.volumes[0]) === null || _b === void 0 ? void 0 : _b.robust_min) !== null && _c !== void 0 ? _c : 0, maxDomain: (_e = (_d = nv.volumes[0]) === null || _d === void 0 ? void 0 : _d.robust_max) !== null && _e !== void 0 ? _e : 1, valueLow: min, valueHigh: max, onChangeLow: function (newMin) {
56
94
  var v = nv.volumes[0];
57
95
  if (!v)
@@ -72,6 +110,6 @@ export function NiivueContrastAdjustments(_a) {
72
110
  var val = Number(e.target.value);
73
111
  setGamma(val);
74
112
  nv.setGamma(val);
75
- }, style: { width: "100%", accentColor: accentColor } }, gammaKey)] })), layerList.length > 0 && (_jsx(Box, __assign({ style: { height: "100%" } }, { children: layerList })))] })) })) }))] })));
113
+ }, style: { width: "100%", accentColor: accentColor } }, gammaKey)] })), _jsx(Box, __assign({ sx: { display: "flex", justifyContent: "flex-end", mt: 0.5, mb: 1 } }, { children: _jsx(Button, __assign({ size: "small", disableRipple: true, startIcon: _jsx(Brightness6Icon, { fontSize: "small" }), onClick: handleResetContrast, sx: resetContrastButtonSx }, { children: "Reset Contrast" })) })), layerList.length > 0 && (_jsx(Box, __assign({ style: { height: "100%" } }, { children: layerList })))] })) })) }))] })));
76
114
  }
77
115
  export default NiivueContrastAdjustments;
@@ -55,7 +55,6 @@ import CenterFocusStrongIcon from '@mui/icons-material/CenterFocusStrong';
55
55
  import ZoomInMapIcon from '@mui/icons-material/ZoomInMap';
56
56
  import ZoomInIcon from '@mui/icons-material/ZoomIn';
57
57
  import ZoomOutIcon from '@mui/icons-material/ZoomOut';
58
- import Brightness6Icon from '@mui/icons-material/Brightness6';
59
58
  import DeleteIcon from "@mui/icons-material/Delete";
60
59
  import CmrConfirmation from "../dialogue/Confirmation";
61
60
  import axios from "axios";
@@ -306,12 +305,7 @@ export default function Toolbar(props) {
306
305
  alignItems: 'center'
307
306
  }, m: 1 }, { children: [_jsx(Typography, __assign({ style: {
308
307
  marginRight: 'auto'
309
- } }, { children: "Labels Visible" })), _jsx(Switch, { defaultChecked: false, checked: props.labelsVisible, onChange: props.toggleLabelsVisible, sx: viewerTheme.muiSwitchSx })] })), _jsx(Box, { sx: { flex: 1 } }), _jsxs(Stack, __assign({ flexDirection: 'row', alignItems: 'center', sx: { m: 2, gap: 0.5 } }, { children: [_jsx(Tooltip, __assign({ title: 'Reset Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetScene(); } }, { children: _jsx(HomeIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Recenter Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.recenter(); } }, { children: _jsx(CenterFocusStrongIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Reset Zooms', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetZoom(); } }, { children: _jsx(ZoomInMapIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Reset Contrast', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () {
310
- var _a, _b;
311
- props.nv.resetContrast();
312
- props.nv.setGamma(1.0); // engine reset
313
- (_b = (_a = props.nv).onResetGamma) === null || _b === void 0 ? void 0 : _b.call(_a); // UI reset: bumps gammaKey + sets gamma=1.0
314
- } }, { children: _jsx(Brightness6Icon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Zoom Out', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () {
308
+ } }, { children: "Labels Visible" })), _jsx(Switch, { defaultChecked: false, checked: props.labelsVisible, onChange: props.toggleLabelsVisible, sx: viewerTheme.muiSwitchSx })] })), _jsx(Box, { sx: { flex: 1 } }), _jsxs(Stack, __assign({ flexDirection: 'row', alignItems: 'center', sx: { m: 2, gap: 0.5 } }, { children: [_jsx(Tooltip, __assign({ title: 'Reset Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetScene(); } }, { children: _jsx(HomeIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Recenter Views', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.recenter(); } }, { children: _jsx(CenterFocusStrongIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Reset Zooms', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetZoom(); } }, { children: _jsx(ZoomInMapIcon, {}) })) })), _jsx(Tooltip, __assign({ title: 'Zoom Out', placement: 'right' }, { children: _jsx(IconButton, __assign({ onClick: function () {
315
309
  var scene = props.nv.scene;
316
310
  var current = scene.pan2Dxyzmm[3];
317
311
  var next = Math.max(0.1, current - 0.1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.9.0",
3
+ "version": "5.0.0",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",