cloudmr-ux 4.2.4 → 4.2.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.
@@ -11,7 +11,6 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import "./tk-dual-range.css";
14
- import CmrLabel from "../label/Label";
15
14
  var clamp = function (v, lo, hi) { return Math.max(lo, Math.min(hi, v)); };
16
15
  export default function TKDualRange(_a) {
17
16
  var _b;
@@ -33,13 +32,20 @@ export default function TKDualRange(_a) {
33
32
  var nextReal = clamp(inverse(nextRender), valueLow, maxDomain);
34
33
  onChangeHigh(nextReal);
35
34
  };
36
- // Editable inputs show RENDER values (like the article)
37
- var fmt = function (v) { return (Number.isFinite(v) ? v.toFixed(precision) : ""); };
35
+ // Editable inputs show RENDER values; use scientific notation for small non-zero
36
+ // values (e.g. B1 maps) so they don't display as "0.000"
37
+ var fmt = function (v) {
38
+ return Number.isFinite(v)
39
+ ? v !== 0 && Math.abs(v) < 0.01
40
+ ? Number(v).toExponential(precision)
41
+ : v.toFixed(precision)
42
+ : "";
43
+ };
38
44
  var parse = function (s) {
39
45
  var n = Number(s);
40
46
  return Number.isFinite(n) ? n : NaN;
41
47
  };
42
- return (_jsxs("div", __assign({ className: "tkdr" }, { children: [_jsxs("div", __assign({ className: "tkdr__row tkdr__row--ends" }, { children: [_jsxs("div", __assign({ className: "tkdr__group" }, { children: [_jsx(CmrLabel, { children: "Min" }), _jsx("input", { className: "tkdr__num", type: "number", step: s, value: fmt(tLow), onChange: function (e) {
48
+ return (_jsxs("div", __assign({ className: "tkdr" }, { children: [_jsxs("div", __assign({ className: "tkdr__row tkdr__row--ends" }, { children: [_jsxs("div", __assign({ className: "tkdr__group" }, { children: [_jsx("span", __assign({ className: "tkdr__hint" }, { children: "Min" })), _jsx("input", { className: "tkdr__num", type: "number", step: s, value: fmt(tLow), onChange: function (e) {
43
49
  var n = parse(e.target.value);
44
50
  if (!Number.isFinite(n))
45
51
  return;
@@ -49,7 +55,7 @@ export default function TKDualRange(_a) {
49
55
  if (!Number.isFinite(n))
50
56
  return;
51
57
  handleLowRender(n);
52
- } })] })), _jsxs("div", __assign({ className: "tkdr__group" }, { children: [_jsx(CmrLabel, { children: "Max" }), _jsx("input", { className: "tkdr__num", type: "number", step: s, value: fmt(tHigh), onChange: function (e) {
58
+ } })] })), _jsxs("div", __assign({ className: "tkdr__group" }, { children: [_jsx("span", __assign({ className: "tkdr__hint" }, { children: "Max" })), _jsx("input", { className: "tkdr__num", type: "number", step: s, value: fmt(tHigh), onChange: function (e) {
53
59
  var n = parse(e.target.value);
54
60
  if (!Number.isFinite(n))
55
61
  return;
@@ -137,4 +137,6 @@
137
137
  /* small, subtle caption */
138
138
  .tkdr__hint {
139
139
  font-size: 0.85rem;
140
+ font-weight: 400;
141
+ font-family: 'Inter', 'Roboto', 'Helvetica', 'Arial', sans-serif;
140
142
  }
@@ -55,6 +55,8 @@ import { getPipelineROI } from "../../../../features/rois/resultActionCreation";
55
55
  import HomeIcon from "@mui/icons-material/Home";
56
56
  import CenterFocusStrongIcon from "@mui/icons-material/CenterFocusStrong";
57
57
  import ZoomInMapIcon from "@mui/icons-material/ZoomInMap";
58
+ import ZoomInIcon from "@mui/icons-material/ZoomIn";
59
+ import ZoomOutIcon from "@mui/icons-material/ZoomOut";
58
60
  import Brightness6Icon from "@mui/icons-material/Brightness6";
59
61
  import AutoGraph from "@mui/icons-material/AutoGraph";
60
62
  export default function Toolbar(props) {
@@ -180,5 +182,35 @@ export default function Toolbar(props) {
180
182
  props.nv.setGamma(1.0); // engine reset
181
183
  (_b = (_a = props.nv).onResetGamma) === null || _b === void 0 ? void 0 : _b.call(_a); // UI reset: bumps gammaKey + sets gamma=1.0
182
184
  // props.nv.resetContrast();
183
- } }, { children: _jsx(AutoGraph, {}) })) })), _jsx(Tooltip, __assign({ title: "Reset Contrast", placement: "right" }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetContrast(); } }, { children: _jsx(Brightness6Icon, {}) })) }))] }))] }))] })) })));
185
+ } }, { children: _jsx(AutoGraph, {}) })) })), _jsx(Tooltip, __assign({ title: "Reset Contrast", placement: "right" }, { children: _jsx(IconButton, __assign({ onClick: function () { return props.nv.resetContrast(); } }, { children: _jsx(Brightness6Icon, {}) })) }))] })), _jsx(Box, { sx: { flex: 1 } }), _jsxs(Stack, __assign({ flexDirection: "row", alignItems: "center", sx: { m: 2, gap: 0.5 } }, { children: [_jsx(Tooltip, __assign({ title: "Zoom Out", placement: "right" }, { children: _jsx(IconButton, __assign({ onClick: function () {
186
+ var scene = props.nv.scene;
187
+ var current = scene.pan2Dxyzmm[3];
188
+ var next = Math.max(0.1, current - 0.1);
189
+ var delta = current - next;
190
+ scene.pan2Dxyzmm[3] = next;
191
+ var mm = props.nv.frac2mm(scene.crosshairPos);
192
+ scene.pan2Dxyzmm[0] += delta * mm[0];
193
+ scene.pan2Dxyzmm[1] += delta * mm[1];
194
+ scene.pan2Dxyzmm[2] += delta * mm[2];
195
+ props.nv.drawScene();
196
+ }, size: "small", sx: {
197
+ border: "1px solid",
198
+ borderColor: "divider",
199
+ borderRadius: 1
200
+ } }, { children: _jsx(ZoomOutIcon, {}) })) })), _jsx(Tooltip, __assign({ title: "Zoom In", placement: "right" }, { children: _jsx(IconButton, __assign({ onClick: function () {
201
+ var scene = props.nv.scene;
202
+ var current = scene.pan2Dxyzmm[3];
203
+ var next = current + 0.1;
204
+ var delta = current - next;
205
+ scene.pan2Dxyzmm[3] = next;
206
+ var mm = props.nv.frac2mm(scene.crosshairPos);
207
+ scene.pan2Dxyzmm[0] += delta * mm[0];
208
+ scene.pan2Dxyzmm[1] += delta * mm[1];
209
+ scene.pan2Dxyzmm[2] += delta * mm[2];
210
+ props.nv.drawScene();
211
+ }, size: "small", sx: {
212
+ border: "1px solid",
213
+ borderColor: "divider",
214
+ borderRadius: 1
215
+ } }, { children: _jsx(ZoomInIcon, {}) })) }))] }))] }))] })) })));
184
216
  }
@@ -23,3 +23,9 @@ export declare const getFileExtension: (fileName: string) => string;
23
23
  */
24
24
  export declare function getMax(array: number[]): number;
25
25
  export declare function getMin(array: number[]): number;
26
+ /**
27
+ * Format a number for UI display, preserving scientific notation for small
28
+ * non-zero values (e.g. B1 maps with values like 1e-5).
29
+ * Uses toExponential when |v| < threshold and v !== 0, otherwise toFixed.
30
+ */
31
+ export declare function formatNumberForDisplay(v: number, precision?: number, scientificThreshold?: number): string;
@@ -116,3 +116,18 @@ export function getMin(array) {
116
116
  }
117
117
  return min;
118
118
  }
119
+ /**
120
+ * Format a number for UI display, preserving scientific notation for small
121
+ * non-zero values (e.g. B1 maps with values like 1e-5).
122
+ * Uses toExponential when |v| < threshold and v !== 0, otherwise toFixed.
123
+ */
124
+ export function formatNumberForDisplay(v, precision, scientificThreshold) {
125
+ if (precision === void 0) { precision = 3; }
126
+ if (scientificThreshold === void 0) { scientificThreshold = 0.01; }
127
+ if (!Number.isFinite(v))
128
+ return "";
129
+ if (v !== 0 && Math.abs(v) < scientificThreshold) {
130
+ return Number(v).toExponential(precision);
131
+ }
132
+ return v.toFixed(precision);
133
+ }
@@ -56,11 +56,13 @@ export var dataSlice = createSlice({
56
56
  }
57
57
  }),
58
58
  builder.addCase(renameUploadedData.fulfilled, function (state, action) {
59
- var id = action.meta.arg.fileId;
60
- for (var _i = 0, _a = state.files; _i < _a.length; _i++) {
61
- var file = _a[_i];
62
- if (file.id == id) {
59
+ var _a = action.meta.arg, fileId = _a.fileId, newName = _a.newName;
60
+ for (var _i = 0, _b = state.files; _i < _b.length; _i++) {
61
+ var file = _b[_i];
62
+ if (file.id === fileId) {
63
+ file.fileName = newName;
63
64
  delete file.renamingPending;
65
+ break;
64
66
  }
65
67
  }
66
68
  }),
@@ -75,12 +77,7 @@ export var dataSlice = createSlice({
75
77
  }),
76
78
  builder.addCase(deleteUploadedData.fulfilled, function (state, action) {
77
79
  var id = action.meta.arg.fileId;
78
- for (var _i = 0, _a = state.files; _i < _a.length; _i++) {
79
- var file = _a[_i];
80
- if (file.id == id) {
81
- delete file.deletionPending;
82
- }
83
- }
80
+ state.files = state.files.filter(function (file) { return file.id !== id; });
84
81
  })); }
85
82
  });
86
83
  export var renameData = (_a = dataSlice.actions, _a.renameData), deleteData = _a.deleteData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudmr-ux",
3
- "version": "4.2.4",
3
+ "version": "4.2.6",
4
4
  "author": "erosmontin@gmail.com",
5
5
  "license": "MIT",
6
6
  "repository": "erosmontin/cloudmr-ux",