Skip to content

Commit 86adc56

Browse files
committed
fix(ColorTransferFunction): misuse of return value
- getNanColor returns an array and accepts no parameters. - getNodeValue sets nodeVal to an array, not object.
1 parent 1e7bf87 commit 86adc56

File tree

1 file changed

+12
-5
lines changed
  • Sources/Rendering/Core/ColorTransferFunction

1 file changed

+12
-5
lines changed

Sources/Rendering/Core/ColorTransferFunction/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,17 @@ function vtkColorTransferFunction(publicAPI, model) {
389389
// todo
390390
const idx = publicAPI.getAnnotatedValueIndexInternal(x);
391391
if (idx < 0 || numNodes === 0) {
392-
publicAPI.getNanColor(rgb);
392+
const nanColor = publicAPI.getNanColorByReference();
393+
rgb[0] = nanColor[0];
394+
rgb[1] = nanColor[1];
395+
rgb[2] = nanColor[2];
393396
} else {
394397
const nodeVal = [];
395398
publicAPI.getNodeValue(idx % numNodes, nodeVal);
396-
rgb[0] = nodeVal.r;
397-
rgb[1] = nodeVal.g;
398-
rgb[2] = nodeVal.b;
399+
// nodeVal[0] is the x value. nodeVal[1...3] is rgb.
400+
rgb[0] = nodeVal[1];
401+
rgb[1] = nodeVal[2];
402+
rgb[2] = nodeVal[3];
399403
}
400404
return;
401405
}
@@ -1030,7 +1034,10 @@ function vtkColorTransferFunction(publicAPI, model) {
10301034
rgba[3] = 1.0; // NodeColor is RGB-only.
10311035
return;
10321036
}
1033-
publicAPI.getNanColor(rgba);
1037+
const nanColor = publicAPI.getNanColorByReference();
1038+
rgba[0] = nanColor[0];
1039+
rgba[1] = nanColor[1];
1040+
rgba[2] = nanColor[2];
10341041
rgba[3] = 1.0; // NanColor is RGB-only.
10351042
};
10361043

0 commit comments

Comments
 (0)