Skip to content

Commit

Permalink
fix(Cursor3D): Doing type conversion in setModelBounds.
Browse files Browse the repository at this point in the history
Without conversion, if model bounds are not numbers, e.g. an array contains string number, the
clampping and warpping may not work correctly. Adding conversion to avoid this situation.
  • Loading branch information
wuzhuobin committed Dec 7, 2018
1 parent cb22e05 commit e44e560
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/Filters/Sources/Cursor3D/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ function vtkCursor3D(publicAPI, model) {
return;
}
publicAPI.modified();
for (let i = 0; i < bounds.length && i < model.modelBounds.length; ++i) {
model.modelBounds[i] = bounds[i];
}
// Doing type convert, make sure it is a number array.
// Without correct coversion, the array may contains string which cause
// the wrapping and clampping works incorrectly.
model.modelBounds = bounds.map((v) => Number(v));
for (let i = 0; i < 3; ++i) {
model.modelBounds[2 * i] = Math.min(
model.modelBounds[2 * i],
Expand Down

0 comments on commit e44e560

Please sign in to comment.