Hello everyone. I’m working on a widget serialization/deserialization feature. I’m able to create a widget out of serialized state by doing this:
const widget = vtkEllipseWidget.newInstance()
const widgetRep = widgetManager.addWidget(widget, ViewTypes.SLICE)
const widgetJson = localStorage.getItem("WIDGET")
const state = JSON.parse(widgetJson)
widget.getWidgetState().getEllipseHandle().setOrigin(state.ellipse)
widget.getWidgetState().getEllipseHandle().setScale3(state.scale)
widget.getWidgetState().getPoint1Handle().setOrigin(state.p1)
widget.getWidgetState().getPoint2Handle().setOrigin(state.p2)
widget.getWidgetState().getPoint1Handle().setVisible(true)
widget.getWidgetState().getPoint2Handle().setVisible(true)
The widget renders fine but I can’t resize it or move it around by using its handles.
I’ve tried widget.setPickable(true)
and widgetManager.enablePicking()
but they don’t seem to have any effect.
How can I create a widget with the typical move / resize capabilities that come out of the box by doing widgetManager.grabFocus(widget)
? Anything I’m missing?