@kitware/vtk.js 25.1.1 → 25.1.2

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.
@@ -187,19 +187,19 @@ function vtkAbstractWidgetFactory(publicAPI, model) {
187
187
  var unsubscribe = NoOp;
188
188
  publicAPI.delete = macro.chain(publicAPI.delete, function () {
189
189
  return unsubscribe();
190
- }); // Defer after object instantiation so model.widgetState actually exist
190
+ });
191
191
 
192
- setTimeout(function () {
193
- if (model.widgetState) {
194
- unsubscribe = model.widgetState.onModified(function () {
195
- return publicAPI.invokeWidgetChange(model.widgetState);
196
- }).unsubscribe;
197
- }
198
- }, 0);
192
+ if (model.widgetState) {
193
+ unsubscribe = model.widgetState.onModified(function () {
194
+ return publicAPI.invokeWidgetChange(model.widgetState);
195
+ }).unsubscribe;
196
+ }
199
197
  } // ----------------------------------------------------------------------------
200
198
 
201
199
 
202
200
  function extend(publicAPI, model) {
201
+ var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
202
+ Object.assign(model, initialValues);
203
203
  macro.obj(publicAPI, model);
204
204
  macro.get(publicAPI, model, ['widgetState']);
205
205
  macro.event(publicAPI, model, 'WidgetChange');
@@ -22,8 +22,6 @@ function vtkAngleWidget(publicAPI, model) {
22
22
 
23
23
 
24
24
  model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
25
- model.behavior = widgetBehavior;
26
- model.widgetState = generateState();
27
25
 
28
26
  publicAPI.getRepresentationsForViewType = function (viewType) {
29
27
  switch (viewType) {
@@ -87,12 +85,18 @@ function vtkAngleWidget(publicAPI, model) {
87
85
  } // ----------------------------------------------------------------------------
88
86
 
89
87
 
90
- var DEFAULT_VALUES = {// manipulator: null,
88
+ var defaultValues = function defaultValues(initialValues) {
89
+ return _objectSpread({
90
+ // manipulator: null,
91
+ behavior: widgetBehavior,
92
+ widgetState: generateState()
93
+ }, initialValues);
91
94
  }; // ----------------------------------------------------------------------------
92
95
 
96
+
93
97
  function extend(publicAPI, model) {
94
98
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
95
- Object.assign(model, DEFAULT_VALUES, initialValues);
99
+ Object.assign(model, defaultValues(initialValues));
96
100
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
97
101
  macro.setGet(publicAPI, model, ['manipulator']);
98
102
  vtkAngleWidget(publicAPI, model);
@@ -22,8 +22,6 @@ function vtkDistanceWidget(publicAPI, model) {
22
22
 
23
23
 
24
24
  model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
25
- model.behavior = widgetBehavior;
26
- model.widgetState = generateState();
27
25
 
28
26
  publicAPI.getRepresentationsForViewType = function (viewType) {
29
27
  switch (viewType) {
@@ -82,12 +80,18 @@ function vtkDistanceWidget(publicAPI, model) {
82
80
  } // ----------------------------------------------------------------------------
83
81
 
84
82
 
85
- var DEFAULT_VALUES = {// manipulator: null,
83
+ var defaultValues = function defaultValues(initialValues) {
84
+ return _objectSpread({
85
+ // manipulator: null,
86
+ behavior: widgetBehavior,
87
+ widgetState: generateState()
88
+ }, initialValues);
86
89
  }; // ----------------------------------------------------------------------------
87
90
 
91
+
88
92
  function extend(publicAPI, model) {
89
93
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
90
- Object.assign(model, DEFAULT_VALUES, initialValues);
94
+ Object.assign(model, defaultValues(initialValues));
91
95
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
92
96
  macro.setGet(publicAPI, model, ['manipulator']);
93
97
  vtkDistanceWidget(publicAPI, model);
@@ -21,7 +21,6 @@ function vtkEllipseWidget(publicAPI, model) {
21
21
  model.classHierarchy.push('vtkEllipseWidget'); // --- Widget Requirement ---------------------------------------------------
22
22
 
23
23
  model.methodsToLink = [].concat(_toConsumableArray(model.methodsToLink), ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'drawBorder', 'drawFace', 'opacity']);
24
- model.behavior = widgetBehavior;
25
24
 
26
25
  publicAPI.getRepresentationsForViewType = function (viewType) {
27
26
  switch (viewType) {
@@ -49,7 +48,6 @@ function vtkEllipseWidget(publicAPI, model) {
49
48
  // --------------------------------------------------------------------------
50
49
 
51
50
 
52
- model.widgetState = generateState();
53
51
  publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
54
52
  useCameraNormal: true
55
53
  }));
@@ -60,6 +58,8 @@ function defaultValues(initialValues) {
60
58
  var _None;
61
59
 
62
60
  return _objectSpread({
61
+ behavior: widgetBehavior,
62
+ widgetState: generateState(),
63
63
  modifierBehavior: {
64
64
  None: (_None = {}, _defineProperty(_None, BehaviorCategory.PLACEMENT, ShapeBehavior[BehaviorCategory.PLACEMENT].CLICK_AND_DRAG), _defineProperty(_None, BehaviorCategory.POINTS, ShapeBehavior[BehaviorCategory.POINTS].CENTER_TO_CORNER), _defineProperty(_None, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FREE), _None),
65
65
  Shift: _defineProperty({}, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FIXED),
@@ -100,8 +100,6 @@ function vtkImageCroppingWidget(publicAPI, model) {
100
100
  }
101
101
  }); // --- Widget Requirement ---------------------------------------------------
102
102
 
103
- model.behavior = widgetBehavior;
104
- model.widgetState = build();
105
103
  model.methodsToLink = ['scaleInPixels']; // Given a view type (geometry, slice, volume), return a description
106
104
  // of what representations to create and what widget state to pass
107
105
  // to the respective representations.
@@ -162,14 +160,20 @@ function vtkImageCroppingWidget(publicAPI, model) {
162
160
  } // ----------------------------------------------------------------------------
163
161
 
164
162
 
165
- var DEFAULT_VALUES = {// cornerManipulator: null,
166
- // edgeManipulator: null,
167
- // faceManipulator: null
163
+ var defaultValues = function defaultValues(initialValues) {
164
+ return _objectSpread({
165
+ // cornerManipulator: null,
166
+ // edgeManipulator: null,
167
+ // faceManipulator: null,
168
+ behavior: widgetBehavior,
169
+ widgetState: build()
170
+ }, initialValues);
168
171
  }; // ----------------------------------------------------------------------------
169
172
 
173
+
170
174
  function extend(publicAPI, model) {
171
175
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
172
- Object.assign(model, DEFAULT_VALUES, initialValues);
176
+ Object.assign(model, defaultValues(initialValues));
173
177
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
174
178
  macro.setGet(publicAPI, model, ['cornerManipulator', 'edgeManipulator', 'faceManipulator']);
175
179
  vtkImageCroppingWidget(publicAPI, model);
@@ -1,3 +1,4 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
3
  import macro from '../../macros.js';
3
4
  import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
@@ -7,6 +8,9 @@ import vtkTrackballManipulator from '../Manipulators/TrackballManipulator.js';
7
8
  import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
8
9
  import { ViewTypes } from '../Core/WidgetManager/Constants.js';
9
10
 
11
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
12
+
13
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
10
14
  // Widget linked to a view
11
15
  // ----------------------------------------------------------------------------
12
16
 
@@ -143,8 +147,6 @@ function widgetBehavior(publicAPI, model) {
143
147
  function vtkImplicitPlaneWidget(publicAPI, model) {
144
148
  model.classHierarchy.push('vtkPlaneWidget'); // --- Widget Requirement ---------------------------------------------------
145
149
 
146
- model.widgetState = vtkImplicitPlaneRepresentation.generateState();
147
- model.behavior = widgetBehavior;
148
150
  model.methodsToLink = ['representationStyle', 'sphereResolution', 'handleSizeRatio', 'axisScale', 'normalVisible', 'originVisible', 'planeVisible', 'outlineVisible'];
149
151
 
150
152
  publicAPI.getRepresentationsForViewType = function (viewType) {
@@ -162,11 +164,17 @@ function vtkImplicitPlaneWidget(publicAPI, model) {
162
164
  } // ----------------------------------------------------------------------------
163
165
 
164
166
 
165
- var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
167
+ var defaultValues = function defaultValues(initialValues) {
168
+ return _objectSpread({
169
+ behavior: widgetBehavior,
170
+ widgetState: vtkImplicitPlaneRepresentation.generateState()
171
+ }, initialValues);
172
+ }; // ----------------------------------------------------------------------------
173
+
166
174
 
167
175
  function extend(publicAPI, model) {
168
176
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
169
- Object.assign(model, DEFAULT_VALUES, initialValues);
177
+ Object.assign(model, defaultValues(initialValues));
170
178
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
171
179
  vtkImplicitPlaneWidget(publicAPI, model);
172
180
  } // ----------------------------------------------------------------------------
@@ -1,3 +1,4 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import macro from '../../macros.js';
2
3
  import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
3
4
  import vtkConvexFaceContextRepresentation from '../Representations/ConvexFaceContextRepresentation.js';
@@ -6,6 +7,9 @@ import { generateState, INITIAL_POINTS } from './InteractiveOrientationWidget/st
6
7
  import { Behavior } from '../Representations/WidgetRepresentation/Constants.js';
7
8
  import { ViewTypes } from '../Core/WidgetManager/Constants.js';
8
9
 
10
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
+
12
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
13
  // Factory
10
14
  // ----------------------------------------------------------------------------
11
15
 
@@ -13,8 +17,6 @@ function vtkInteractiveOrientationWidget(publicAPI, model) {
13
17
  model.classHierarchy.push('vtkInteractiveOrientationWidget'); // --- Widget Requirement ---------------------------------------------------
14
18
 
15
19
  model.methodsToLink = ['closePolyLine', 'activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale'];
16
- model.behavior = widgetBehavior;
17
- model.widgetState = generateState();
18
20
 
19
21
  publicAPI.setBounds = function (bounds) {
20
22
  var handles = model.widgetState.getStatesWithLabel('handles');
@@ -107,11 +109,17 @@ function vtkInteractiveOrientationWidget(publicAPI, model) {
107
109
  } // ----------------------------------------------------------------------------
108
110
 
109
111
 
110
- var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
112
+ var defaultValues = function defaultValues(initialValues) {
113
+ return _objectSpread({
114
+ behavior: widgetBehavior,
115
+ widgetState: generateState()
116
+ }, initialValues);
117
+ }; // ----------------------------------------------------------------------------
118
+
111
119
 
112
120
  function extend(publicAPI, model) {
113
121
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
114
- Object.assign(model, DEFAULT_VALUES, initialValues);
122
+ Object.assign(model, defaultValues(initialValues));
115
123
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
116
124
  vtkInteractiveOrientationWidget(publicAPI, model);
117
125
  } // ----------------------------------------------------------------------------
@@ -22,8 +22,6 @@ function vtkLabelWidget(publicAPI, model) {
22
22
 
23
23
 
24
24
  model.methodsToLink = ['textProps', 'fontProperties', 'strokeFontProperties', 'scaleInPixels'];
25
- model.behavior = widgetBehavior;
26
- model.widgetState = generateState();
27
25
 
28
26
  publicAPI.getRepresentationsForViewType = function (viewType) {
29
27
  switch (viewType) {
@@ -72,7 +70,10 @@ function vtkLabelWidget(publicAPI, model) {
72
70
 
73
71
 
74
72
  function defaultValues(initialValues) {
75
- return _objectSpread({}, initialValues);
73
+ return _objectSpread({
74
+ behavior: widgetBehavior,
75
+ widgetState: generateState()
76
+ }, initialValues);
76
77
  } // ----------------------------------------------------------------------------
77
78
 
78
79
 
@@ -21,10 +21,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
21
21
  function vtkLineWidget(publicAPI, model) {
22
22
  model.classHierarchy.push('vtkLineWidget');
23
23
 
24
- var superClass = _objectSpread({}, publicAPI);
24
+ var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
25
25
 
26
- model.widgetState = generateState();
27
- model.behavior = widgetBehavior; // --- Widget Requirement ---------------------------------------------------
28
26
 
29
27
  model.methodsToLink = ['activeScaleFactor', 'activeColor', 'useActiveColor', 'glyphResolution', 'defaultScale', 'scaleInPixels'];
30
28
 
@@ -165,12 +163,18 @@ function vtkLineWidget(publicAPI, model) {
165
163
  } // ----------------------------------------------------------------------------
166
164
 
167
165
 
168
- var DEFAULT_VALUES = {// manipulator: null,
166
+ var defaultValues = function defaultValues(initialValues) {
167
+ return _objectSpread({
168
+ // manipulator: null,
169
+ behavior: widgetBehavior,
170
+ widgetState: generateState()
171
+ }, initialValues);
169
172
  }; // ----------------------------------------------------------------------------
170
173
 
174
+
171
175
  function extend(publicAPI, model) {
172
176
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
173
- Object.assign(model, DEFAULT_VALUES, initialValues);
177
+ Object.assign(model, defaultValues(initialValues));
174
178
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
175
179
  macro.setGet(publicAPI, model, ['manipulator']);
176
180
  vtkLineWidget(publicAPI, model);
@@ -20,9 +20,6 @@ function vtkPaintWidget(publicAPI, model) {
20
20
  var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
21
21
 
22
22
 
23
- model.behavior = widgetBehavior;
24
- model.widgetState = generateState(model.radius);
25
-
26
23
  publicAPI.getRepresentationsForViewType = function (viewType) {
27
24
  switch (viewType) {
28
25
  case ViewTypes.DEFAULT:
@@ -67,16 +64,23 @@ function vtkPaintWidget(publicAPI, model) {
67
64
  } // ----------------------------------------------------------------------------
68
65
 
69
66
 
70
- var DEFAULT_VALUES = {
71
- // manipulator: null,
72
- radius: 1,
73
- painting: false,
74
- color: [1]
67
+ var defaultValues = function defaultValues(initialValues) {
68
+ var _initialValues$radius;
69
+
70
+ return _objectSpread({
71
+ // manipulator: null,
72
+ radius: 1,
73
+ painting: false,
74
+ color: [1],
75
+ behavior: widgetBehavior,
76
+ widgetState: generateState((_initialValues$radius = initialValues === null || initialValues === void 0 ? void 0 : initialValues.radius) !== null && _initialValues$radius !== void 0 ? _initialValues$radius : 1)
77
+ }, initialValues);
75
78
  }; // ----------------------------------------------------------------------------
76
79
 
80
+
77
81
  function extend(publicAPI, model) {
78
82
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
79
- Object.assign(model, DEFAULT_VALUES, initialValues);
83
+ Object.assign(model, defaultValues(initialValues));
80
84
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
81
85
  macro.get(publicAPI, model, ['painting']);
82
86
  macro.setGet(publicAPI, model, ['manipulator', 'radius', 'color']);
@@ -22,8 +22,6 @@ function vtkPolyLineWidget(publicAPI, model) {
22
22
 
23
23
 
24
24
  model.methodsToLink = ['activeColor', 'activeScaleFactor', 'closePolyLine', 'defaultScale', 'glyphResolution', 'lineThickness', 'useActiveColor', 'scaleInPixels'];
25
- model.behavior = widgetBehavior;
26
- model.widgetState = generateState();
27
25
 
28
26
  publicAPI.getRepresentationsForViewType = function (viewType) {
29
27
  switch (viewType) {
@@ -78,12 +76,18 @@ function vtkPolyLineWidget(publicAPI, model) {
78
76
  } // ----------------------------------------------------------------------------
79
77
 
80
78
 
81
- var DEFAULT_VALUES = {// manipulator: null,
79
+ var defaultValues = function defaultValues(initialValues) {
80
+ return _objectSpread({
81
+ manipulator: null,
82
+ behavior: widgetBehavior,
83
+ widgetState: generateState()
84
+ }, initialValues);
82
85
  }; // ----------------------------------------------------------------------------
83
86
 
87
+
84
88
  function extend(publicAPI, model) {
85
89
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
86
- Object.assign(model, DEFAULT_VALUES, initialValues);
90
+ Object.assign(model, defaultValues(initialValues));
87
91
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
88
92
  macro.setGet(publicAPI, model, ['manipulator']);
89
93
  vtkPolyLineWidget(publicAPI, model);
@@ -21,8 +21,6 @@ function vtkRectangleWidget(publicAPI, model) {
21
21
  model.classHierarchy.push('vtkRectangleWidget');
22
22
  model.methodsToLink = [].concat(_toConsumableArray(model.methodsToLink), ['activeScaleFactor', 'activeColor', 'useActiveColor', 'drawBorder', 'drawFace', 'opacity']); // --- Widget Requirement ---------------------------------------------------
23
23
 
24
- model.behavior = widgetBehavior;
25
-
26
24
  publicAPI.getRepresentationsForViewType = function (viewType) {
27
25
  switch (viewType) {
28
26
  case ViewTypes.DEFAULT:
@@ -49,7 +47,6 @@ function vtkRectangleWidget(publicAPI, model) {
49
47
  // --------------------------------------------------------------------------
50
48
 
51
49
 
52
- model.widgetState = generateState();
53
50
  model.manipulator = vtkPlanePointManipulator.newInstance({
54
51
  useCameraNormal: true
55
52
  });
@@ -60,6 +57,8 @@ function defaultValues(initialValues) {
60
57
  var _None;
61
58
 
62
59
  return _objectSpread({
60
+ behavior: widgetBehavior,
61
+ widgetState: generateState(),
63
62
  modifierBehavior: {
64
63
  None: (_None = {}, _defineProperty(_None, BehaviorCategory.PLACEMENT, ShapeBehavior[BehaviorCategory.PLACEMENT].CLICK_AND_DRAG), _defineProperty(_None, BehaviorCategory.POINTS, ShapeBehavior[BehaviorCategory.POINTS].CORNER_TO_CORNER), _defineProperty(_None, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FREE), _None),
65
64
  Shift: _defineProperty({}, BehaviorCategory.RATIO, ShapeBehavior[BehaviorCategory.RATIO].FIXED),
@@ -1,3 +1,4 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
1
2
  import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
2
3
  import macro from '../../macros.js';
3
4
  import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
@@ -12,6 +13,9 @@ import { ViewTypes } from '../Core/WidgetManager/Constants.js';
12
13
  import { mat4, vec4 } from 'gl-matrix';
13
14
  import vtkMatrixBuilder from '../../Common/Core/MatrixBuilder.js';
14
15
 
16
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
+
18
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
19
  var VTK_INT_MAX = 2147483647;
16
20
  var vtkErrorMacro = macro.vtkErrorMacro; // ----------------------------------------------------------------------------
17
21
  // Factory
@@ -136,9 +140,6 @@ function vtkResliceCursorWidget(publicAPI, model) {
136
140
  // --------------------------------------------------------------------------
137
141
 
138
142
 
139
- model.behavior = widgetBehavior;
140
- model.widgetState = generateState();
141
-
142
143
  publicAPI.getRepresentationsForViewType = function (viewType) {
143
144
  switch (viewType) {
144
145
  case ViewTypes.XY_PLANE:
@@ -400,11 +401,17 @@ function vtkResliceCursorWidget(publicAPI, model) {
400
401
  } // ----------------------------------------------------------------------------
401
402
 
402
403
 
403
- var DEFAULT_VALUES = {}; // ----------------------------------------------------------------------------
404
+ var defaultValues = function defaultValues(initialValues) {
405
+ return _objectSpread({
406
+ behavior: widgetBehavior,
407
+ widgetState: generateState()
408
+ }, initialValues);
409
+ }; // ----------------------------------------------------------------------------
410
+
404
411
 
405
412
  function extend(publicAPI, model) {
406
413
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
407
- Object.assign(model, DEFAULT_VALUES, initialValues);
414
+ Object.assign(model, defaultValues(initialValues));
408
415
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
409
416
  vtkResliceCursorWidget(publicAPI, model);
410
417
  } // ----------------------------------------------------------------------------
@@ -17,7 +17,6 @@ function vtkSphereWidget(publicAPI, model) {
17
17
 
18
18
  var superClass = _objectSpread({}, publicAPI);
19
19
 
20
- model.behavior = widgetBehavior;
21
20
  model.methodsToLink = ['scaleInPixels'];
22
21
 
23
22
  publicAPI.getRepresentationsForViewType = function (viewType) {
@@ -53,15 +52,21 @@ function vtkSphereWidget(publicAPI, model) {
53
52
  // --------------------------------------------------------------------------
54
53
 
55
54
 
56
- model.widgetState = stateGenerator();
57
55
  publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
58
56
  useCameraNormal: true
59
57
  }));
60
58
  }
61
59
 
60
+ var defaultValues = function defaultValues(initialValues) {
61
+ return _objectSpread({
62
+ behavior: widgetBehavior,
63
+ widgetState: stateGenerator()
64
+ }, initialValues);
65
+ };
66
+
62
67
  function extend(publicAPI, model) {
63
68
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
64
- Object.assign(model, {}, initialValues);
69
+ Object.assign(model, defaultValues(initialValues));
65
70
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
66
71
  macro.setGet(publicAPI, model, ['manipulator', 'widgetState']);
67
72
  vtkSphereWidget(publicAPI, model);
@@ -21,8 +21,6 @@ function vtkSplineWidget(publicAPI, model) {
21
21
 
22
22
 
23
23
  model.methodsToLink = ['boundaryCondition', 'close', 'outputBorder', 'fill', 'borderColor', 'errorBorderColor', 'scaleInPixels'];
24
- model.behavior = widgetBehavior;
25
- model.widgetState = generateState();
26
24
 
27
25
  publicAPI.getRepresentationsForViewType = function (viewType) {
28
26
  switch (viewType) {
@@ -60,21 +58,26 @@ function vtkSplineWidget(publicAPI, model) {
60
58
  } // ----------------------------------------------------------------------------
61
59
 
62
60
 
63
- var DEFAULT_VALUES = {
64
- // manipulator: null,
65
- freehandMinDistance: 0.1,
66
- allowFreehand: true,
67
- resolution: 32,
68
- // propagates to SplineContextRepresentation
69
- defaultCursor: 'pointer',
70
- handleSizeInPixels: 10,
71
- // propagates to SplineContextRepresentation
72
- resetAfterPointPlacement: false
61
+ var defaultValues = function defaultValues(initialValues) {
62
+ return _objectSpread({
63
+ // manipulator: null,
64
+ freehandMinDistance: 0.1,
65
+ allowFreehand: true,
66
+ resolution: 32,
67
+ // propagates to SplineContextRepresentation
68
+ defaultCursor: 'pointer',
69
+ handleSizeInPixels: 10,
70
+ // propagates to SplineContextRepresentation
71
+ resetAfterPointPlacement: false,
72
+ behavior: widgetBehavior,
73
+ widgetState: generateState()
74
+ }, initialValues);
73
75
  }; // ----------------------------------------------------------------------------
74
76
 
77
+
75
78
  function extend(publicAPI, model) {
76
79
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
77
- Object.assign(model, DEFAULT_VALUES, initialValues);
80
+ Object.assign(model, defaultValues(initialValues));
78
81
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
79
82
  macro.setGet(publicAPI, model, ['manipulator', 'freehandMinDistance', 'allowFreehand', 'resolution', 'defaultCursor', 'handleSizeInPixels', 'resetAfterPointPlacement']);
80
83
  vtkSplineWidget(publicAPI, model);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "25.1.1",
3
+ "version": "25.1.2",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",