All files / Sources/Widgets/Widgets3D/SphereWidget state.js

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52          1x                                                                                            
import vtkStateBuilder from 'vtk.js/Sources/Widgets/Core/StateBuilder';
 
// Defines the structure of the widget state.
// See https://kitware.github.io/vtk-js/docs/concepts_widgets.html.
export default function stateGenerator() {
  return (
    vtkStateBuilder
      .createBuilder()
      // The handle used only for during initial placement.
      .addStateFromMixin({
        labels: ['moveHandle'],
        mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
        name: 'moveHandle',
        initialValues: {
          scale1: 20,
          visible: true,
        },
      })
      // The handle for the center of the sphere.
      .addStateFromMixin({
        labels: ['centerHandle'],
        mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
        name: 'centerHandle',
        initialValues: {
          scale1: 20,
          visible: true,
        },
      })
      // The handle for a border point of the sphere.
      .addStateFromMixin({
        labels: ['borderHandle'],
        mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
        name: 'borderHandle',
        initialValues: {
          scale1: 20,
          visible: true,
        },
      })
      // For displaying the sphere.
      .addStateFromMixin({
        labels: ['sphereHandle'],
        mixins: ['origin', 'color', 'scale1', 'visible', 'orientation'],
        name: 'sphereHandle',
        initialValues: {
          visible: true,
          radius: 1,
        },
      })
      .build()
  );
}