@kitware/vtk.js 28.2.4 → 28.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.
@@ -68,13 +68,14 @@ function vtkLookupTable(publicAPI, model) {
68
68
 
69
69
  publicAPI.linearIndexLookup = function (v, p) {
70
70
  var dIndex = 0;
71
+ var nv = Number(v);
71
72
 
72
- if (v < p.range[0]) {
73
+ if (nv < p.range[0]) {
73
74
  dIndex = p.maxIndex + BELOW_RANGE_COLOR_INDEX + 1.5;
74
- } else if (v > p.range[1]) {
75
+ } else if (nv > p.range[1]) {
75
76
  dIndex = p.maxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5;
76
77
  } else {
77
- dIndex = (v + p.shift) * p.scale; // This conditional is needed because when v is very close to
78
+ dIndex = (nv + p.shift) * p.scale; // This conditional is needed because when v is very close to
78
79
  // p.Range[1], it may map above p.MaxIndex in the linear mapping
79
80
  // above.
80
81
 
@@ -323,12 +323,16 @@ function vtkMapper(publicAPI, model) {
323
323
  numberOfColors = 4094;
324
324
  }
325
325
 
326
+ if (numberOfColors < 64) {
327
+ numberOfColors = 64;
328
+ }
329
+
326
330
  numberOfColors += 2;
327
- var k = (range[1] - range[0]) / (numberOfColors - 1 - 2);
331
+ var k = (range[1] - range[0]) / (numberOfColors - 2);
328
332
  var newArray = new Float64Array(numberOfColors * 2);
329
333
 
330
334
  for (var i = 0; i < numberOfColors; ++i) {
331
- newArray[i] = range[0] + i * k - k; // minus k to start at below range color
335
+ newArray[i] = range[0] + i * k - k / 2.0; // minus k / 2 to start at below range color
332
336
 
333
337
  if (useLogScale) {
334
338
  newArray[i] = Math.pow(10.0, newArray[i]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "28.2.4",
3
+ "version": "28.2.6",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",