Skip to content

Commit 5632d4a

Browse files
committed
fix(Proxy): Allow dataset to be removed
1 parent 3a71297 commit 5632d4a

File tree

2 files changed

+7
-3
lines changed
  • Sources/Proxy
    • Core/AbstractRepresentationProxy
    • Representations/SliceRepresentationProxy

2 files changed

+7
-3
lines changed

Sources/Proxy/Core/AbstractRepresentationProxy/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function vtkAbstractRepresentationProxy(publicAPI, model) {
2727
publicAPI.updateColorByDomain();
2828
};
2929

30-
publicAPI.getInputDataSet = () => model.input.getDataset();
30+
publicAPI.getInputDataSet = () => model.input ? model.input.getDataset() : null;
3131

3232
publicAPI.getDataArray = (arrayName, arrayLocation) => {
3333
const [selectedArray, selectedLocation] = publicAPI.getColorBy();

Sources/Proxy/Representations/SliceRepresentationProxy/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function vtkSliceRepresentationProxy(publicAPI, model) {
123123
model.mapper[`set${model.slicingMode}Slice`](index);
124124

125125
publicAPI.getSliceIndex = () =>
126-
model.mapper[`get${model.slicingMode}Slice`]();
126+
model.slicingMode ? model.mapper[`get${model.slicingMode}Slice`]() : 0;
127127

128128
publicAPI.setSlicingMode = (mode) => {
129129
if (!mode) {
@@ -148,8 +148,12 @@ function vtkSliceRepresentationProxy(publicAPI, model) {
148148

149149
// Used for UI
150150
publicAPI.getSliceIndexValues = () => {
151+
const ds = publicAPI.getInputDataSet();
152+
if (!ds) {
153+
return [];
154+
}
151155
const values = [];
152-
const extent = publicAPI.getInputDataSet().getExtent();
156+
const extent = ds.getExtent();
153157
const axisIndex = 'XYZ'.indexOf(model.slicingMode);
154158
const endValue = extent[axisIndex * 2 + 1];
155159
let currentValue = extent[axisIndex * 2];

0 commit comments

Comments
 (0)