Skip to content

Commit

Permalink
Merge pull request #117 from jadh4v/fix-DataArray-setRange
Browse files Browse the repository at this point in the history
Fix setRange call to vtkDataArray for single component arrays
  • Loading branch information
floryst authored Jul 27, 2023
2 parents 1d86e33 + f2efe04 commit d45d66d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/core/DataArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export default function DataArray(props: DataArrayProps) {
const typedArrayClass = TypedArrayLookup[TYPED_ARRAYS[type]];
array.setData(toTypedArray(values, typedArrayClass), numberOfComponents);
if (range) {
array.setRange(range, numberOfComponents);
if (numberOfComponents === 1) {
array.setRange(range, 0);
} else {
array.setRange(range, numberOfComponents);
}
}
}

Expand Down

0 comments on commit d45d66d

Please sign in to comment.