@kitware/vtk.js 25.1.1 → 25.2.0

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.
@@ -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.2.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",