@kitware/vtk.js 24.12.0 → 24.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,57 +1,58 @@
1
1
  import vtkStateBuilder from '../../Core/StateBuilder.js';
2
- import { handleTypeFromName, AXES } from './helpers.js';
3
-
4
- var builder = vtkStateBuilder.createBuilder(); // add image data description fields
5
-
6
- builder.addField({
7
- name: 'indexToWorldT',
8
- initialValue: Array(16).fill(0)
9
- }).addField({
10
- name: 'worldToIndexT',
11
- initialValue: Array(16).fill(0)
12
- }); // make cropping planes a sub-state so we can listen to it
13
- // separately from the rest of the widget state.
14
-
15
- var croppingState = vtkStateBuilder.createBuilder().addField({
16
- name: 'planes',
17
- // index space
18
- initialValue: [0, 1, 0, 1, 0, 1]
19
- }).build(); // add cropping planes state to our primary state
20
-
21
- builder.addStateFromInstance({
22
- labels: ['croppingPlanes'],
23
- name: 'croppingPlanes',
24
- instance: croppingState
25
- }); // add all handle states
26
- // default bounds is [-1, 1] in all dimensions
27
-
28
- for (var i = -1; i < 2; i++) {
29
- for (var j = -1; j < 2; j++) {
30
- for (var k = -1; k < 2; k++) {
31
- // skip center of box
32
- if (i !== 0 || j !== 0 || k !== 0) {
33
- var name = AXES[i + 1] + AXES[j + 1] + AXES[k + 1];
34
- var type = handleTypeFromName(name); // since handle states are rendered via vtkSphereHandleRepresentation,
35
- // we can dictate the handle origin, size (scale1), color, and visibility.
36
-
37
- builder.addStateFromMixin({
38
- labels: ['handles', name, type],
39
- mixins: ['name', 'origin', 'color', 'scale1', 'visible', 'manipulator'],
40
- name: name,
41
- initialValues: {
42
- scale1: 10,
43
- origin: [i, j, k],
44
- visible: true,
45
- name: name
46
- }
47
- });
2
+ import { AXES, handleTypeFromName } from './helpers.js';
3
+
4
+ function build() {
5
+ // create our state builder
6
+ var builder = vtkStateBuilder.createBuilder(); // add image data description fields
7
+
8
+ builder.addField({
9
+ name: 'indexToWorldT',
10
+ initialValue: Array(16).fill(0)
11
+ }).addField({
12
+ name: 'worldToIndexT',
13
+ initialValue: Array(16).fill(0)
14
+ }); // make cropping planes a sub-state so we can listen to it
15
+ // separately from the rest of the widget state.
16
+
17
+ var croppingState = vtkStateBuilder.createBuilder().addField({
18
+ name: 'planes',
19
+ // index space
20
+ initialValue: [0, 1, 0, 1, 0, 1]
21
+ }).build(); // add cropping planes state to our primary state
22
+
23
+ builder.addStateFromInstance({
24
+ labels: ['croppingPlanes'],
25
+ name: 'croppingPlanes',
26
+ instance: croppingState
27
+ }); // add all handle states
28
+ // default bounds is [-1, 1] in all dimensions
29
+
30
+ for (var i = -1; i < 2; i++) {
31
+ for (var j = -1; j < 2; j++) {
32
+ for (var k = -1; k < 2; k++) {
33
+ // skip center of box
34
+ if (i !== 0 || j !== 0 || k !== 0) {
35
+ var name = AXES[i + 1] + AXES[j + 1] + AXES[k + 1];
36
+ var type = handleTypeFromName(name); // since handle states are rendered via vtkSphereHandleRepresentation,
37
+ // we can dictate the handle origin, size (scale1), color, and visibility.
38
+
39
+ builder.addStateFromMixin({
40
+ labels: ['handles', name, type],
41
+ mixins: ['name', 'origin', 'color', 'scale1', 'visible', 'manipulator'],
42
+ name: name,
43
+ initialValues: {
44
+ scale1: 10,
45
+ origin: [i, j, k],
46
+ visible: true,
47
+ name: name
48
+ }
49
+ });
50
+ }
48
51
  }
49
52
  }
50
53
  }
51
- }
52
54
 
53
- var state = (function () {
54
55
  return builder.build();
55
- });
56
+ }
56
57
 
57
- export { state as default };
58
+ export { build as default };
@@ -8,7 +8,7 @@ import vtkLineManipulator from '../Manipulators/LineManipulator.js';
8
8
  import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
9
9
  import vtkCroppingOutlineRepresentation from '../Representations/CroppingOutlineRepresentation.js';
10
10
  import widgetBehavior from './ImageCroppingWidget/behavior.js';
11
- import state from './ImageCroppingWidget/state.js';
11
+ import build from './ImageCroppingWidget/state.js';
12
12
  import { transformVec3, AXES } from './ImageCroppingWidget/helpers.js';
13
13
  import { ViewTypes } from '../Core/WidgetManager/Constants.js';
14
14
 
@@ -101,7 +101,7 @@ function vtkImageCroppingWidget(publicAPI, model) {
101
101
  }); // --- Widget Requirement ---------------------------------------------------
102
102
 
103
103
  model.behavior = widgetBehavior;
104
- model.widgetState = state(); // Given a view type (geometry, slice, volume), return a description
104
+ model.widgetState = build(); // Given a view type (geometry, slice, volume), return a description
105
105
  // of what representations to create and what widget state to pass
106
106
  // to the respective representations.
107
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.12.0",
3
+ "version": "24.12.1",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",