I’m currently extending the existing image cropping widget with some extra additions of my own. My question is now how I would go by extending the existing state with an extra field.
Normally I would go by making a StateGenerator()
which creates a new state using the vtkStateBuilder
.
But I now can’t overwrite the existing state, but I would like to add a field to the existing model.widgetState
of the vtkImageCroppingWidget
.
I tried using
const newState = vtkStateBuilder .createBuilder() .addField({ name: 'slices', initialValue: [0, 0, 0] }) .build(); model.widgetState.bindState(newState, 'extendedState');
But for some reason this just creates multiple substates which are never destroyed even after the widget is destroyed? And also do not contain the fields from the existing imageCroppingWidget state.
Is there a better/easier way to add certain fields to the existing state? Or am I missing something obvious?
Kind regards,
Emil