@cornerstonejs/core 1.45.0 → 1.46.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.45.0",
3
+ "version": "1.46.0",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/types/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "type": "individual",
48
48
  "url": "https://ohif.org/donate"
49
49
  },
50
- "gitHead": "87999af23a3e0f399c2c3df80587b662ab079b93"
50
+ "gitHead": "935b1d61a7e9a5e668b51577d6491f026dcae6db"
51
51
  }
@@ -23,21 +23,22 @@ function roundNumber(
23
23
  return 'NaN';
24
24
  }
25
25
  value = Number(value);
26
- if (value < 0.0001) {
26
+ const absValue = Math.abs(value);
27
+ if (absValue < 0.0001) {
27
28
  return `${value}`;
28
29
  }
29
30
  const fixedPrecision =
30
- value >= 100
31
+ absValue >= 100
31
32
  ? precision - 2
32
- : value >= 10
33
+ : absValue >= 10
33
34
  ? precision - 1
34
- : value >= 1
35
+ : absValue >= 1
35
36
  ? precision
36
- : value >= 0.1
37
+ : absValue >= 0.1
37
38
  ? precision + 1
38
- : value >= 0.01
39
+ : absValue >= 0.01
39
40
  ? precision + 2
40
- : value >= 0.001
41
+ : absValue >= 0.001
41
42
  ? precision + 3
42
43
  : precision + 4;
43
44
  return value.toFixed(fixedPrecision);