@thewtex/vtk.js-esm
Version:
Visualization Toolkit for the Web
55 lines (51 loc) • 1.44 kB
JavaScript
import vtkStateBuilder from '../../Core/StateBuilder.js';
// separately from the rest of the widget state.
var linePosState = vtkStateBuilder.createBuilder().addField({
name: 'posOnLine',
initialValue: 0.5
}).build();
function generateState() {
return vtkStateBuilder.createBuilder().addStateFromMixin({
labels: ['moveHandle'],
mixins: ['origin', 'color', 'scale1', 'visible', 'shape'],
name: 'moveHandle',
initialValues: {
scale1: 50,
origin: [],
visible: true
}
}).addStateFromMixin({
labels: ['handle1'],
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator', 'shape'],
name: 'handle1',
initialValues: {
scale1: 50,
origin: []
}
}).addStateFromMixin({
labels: ['handle2'],
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator', 'shape'],
name: 'handle2',
initialValues: {
scale1: 50,
origin: []
}
}).addStateFromMixin({
labels: ['SVGtext'],
mixins: ['origin', 'color', 'text', 'visible'],
name: 'text',
initialValues: {
/* text is empty to set a text filed in the SVGLayer and to avoid
* displaying text before positioning the handles */
text: '',
visible: false,
origin: [0, 0, 0]
}
}).addStateFromInstance({
name: 'positionOnLine',
instance: linePosState
}).addField({
name: 'lineThickness'
}).build();
}
export default generateState;