@kitware/vtk.js 24.18.8 → 24.18.9

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.
@@ -254,14 +254,19 @@ function vtkCellPicker(publicAPI, model) {
254
254
  var tempCellMap = createCellMap();
255
255
  var minCellMap = createCellMap();
256
256
  var numberOfCells = data.getNumberOfCells();
257
+ /* eslint-disable no-continue */
257
258
 
258
259
  for (var cellId = 0; cellId < numberOfCells; cellId++) {
259
260
  var pCoords = [0, 0, 0];
260
- minCellType = data.getCellType(cellId);
261
+ minCellType = data.getCellType(cellId); // Skip cells that are marked as empty
262
+
263
+ if (minCellType === CellType.VTK_EMPTY_CELL) {
264
+ continue;
265
+ }
266
+
261
267
  var cell = tempCellMap[minCellType];
262
268
 
263
269
  if (cell == null) {
264
- // eslint-disable-next-line no-continue
265
270
  continue;
266
271
  }
267
272
 
@@ -294,6 +299,8 @@ function vtkCellPicker(publicAPI, model) {
294
299
  }
295
300
  }
296
301
  }
302
+ /* eslint-enable no-continue */
303
+
297
304
  }
298
305
 
299
306
  if (minCellId >= 0 && tMin < model.globalTMin) {
@@ -5,7 +5,7 @@ import vtkPointPicker from '../../../Rendering/Core/PointPicker.js';
5
5
  var MAX_POINTS = 3;
6
6
  function widgetBehavior(publicAPI, model) {
7
7
  model.classHierarchy.push('vtkAngleWidgetProp');
8
- var isDragging = null;
8
+ model._isDragging = false;
9
9
  var picker = vtkPointPicker.newInstance();
10
10
  picker.setPickFromList(1); // --------------------------------------------------------------------------
11
11
  // Display 2D
@@ -46,8 +46,8 @@ function widgetBehavior(publicAPI, model) {
46
46
  newHandle.setColor(moveHandle.getColor());
47
47
  newHandle.setScale1(moveHandle.getScale1());
48
48
  newHandle.setManipulator(manipulator);
49
- } else {
50
- isDragging = true;
49
+ } else if (model.dragable) {
50
+ model._isDragging = true;
51
51
 
52
52
  model._apiSpecificRenderWindow.setCursor('grabbing');
53
53
 
@@ -69,7 +69,8 @@ function widgetBehavior(publicAPI, model) {
69
69
  if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
70
70
  var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
71
71
 
72
- if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
72
+ if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || model._isDragging) && model.activeState.setOrigin // e.g. the line is pickable but not draggable
73
+ ) {
73
74
  model.activeState.setOrigin(worldCoords);
74
75
  publicAPI.invokeInteractionEvent();
75
76
  return macro.EVENT_ABORT;
@@ -87,32 +88,35 @@ function widgetBehavior(publicAPI, model) {
87
88
 
88
89
 
89
90
  publicAPI.handleLeftButtonRelease = function () {
90
- if (isDragging && model.pickable) {
91
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
92
+ return macro.VOID;
93
+ }
94
+
95
+ if (model.hasFocus && model.widgetState.getHandleList().length === MAX_POINTS) {
96
+ publicAPI.loseFocus();
97
+ return macro.VOID;
98
+ }
99
+
100
+ if (model._isDragging) {
91
101
  model._apiSpecificRenderWindow.setCursor('pointer');
92
102
 
93
103
  model.widgetState.deactivate();
94
104
 
95
105
  model._interactor.cancelAnimation(publicAPI);
96
106
 
97
- publicAPI.invokeEndInteractionEvent();
107
+ model._isDragging = false;
98
108
  } else if (model.activeState !== model.widgetState.getMoveHandle()) {
99
109
  model.widgetState.deactivate();
100
110
  }
101
111
 
102
112
  if (model.hasFocus && !model.activeState || model.activeState && !model.activeState.getActive()) {
103
- publicAPI.invokeEndInteractionEvent();
104
-
105
113
  model._widgetManager.enablePicking();
106
114
 
107
115
  model._interactor.render();
108
- } // Don't make any more points
109
-
110
-
111
- if (model.widgetState.getHandleList().length === MAX_POINTS) {
112
- publicAPI.loseFocus();
113
116
  }
114
117
 
115
- isDragging = false;
118
+ publicAPI.invokeEndInteractionEvent();
119
+ return macro.EVENT_ABORT;
116
120
  }; // --------------------------------------------------------------------------
117
121
  // Focus API - modeHandle follow mouse when widget has focus
118
122
  // --------------------------------------------------------------------------
@@ -4,7 +4,7 @@ import macro from '../../../macros.js';
4
4
  var MAX_POINTS = 2;
5
5
  function widgetBehavior(publicAPI, model) {
6
6
  model.classHierarchy.push('vtkDistanceWidgetProp');
7
- var isDragging = null; // --------------------------------------------------------------------------
7
+ model._isDragging = false; // --------------------------------------------------------------------------
8
8
  // Display 2D
9
9
  // --------------------------------------------------------------------------
10
10
 
@@ -41,8 +41,8 @@ function widgetBehavior(publicAPI, model) {
41
41
  newHandle.setColor(moveHandle.getColor());
42
42
  newHandle.setScale1(moveHandle.getScale1());
43
43
  newHandle.setManipulator(manipulator);
44
- } else {
45
- isDragging = true;
44
+ } else if (model.dragable) {
45
+ model._isDragging = true;
46
46
 
47
47
  model._apiSpecificRenderWindow.setCursor('grabbing');
48
48
 
@@ -59,17 +59,13 @@ function widgetBehavior(publicAPI, model) {
59
59
  publicAPI.handleMouseMove = function (callData) {
60
60
  var _model$activeState$ge3, _model$activeState2, _model$activeState2$g;
61
61
 
62
- if (model.hasFocus && model.widgetState.getHandleList().length === MAX_POINTS) {
63
- publicAPI.loseFocus();
64
- return macro.VOID;
65
- }
66
-
67
62
  var manipulator = (_model$activeState$ge3 = (_model$activeState2 = model.activeState) === null || _model$activeState2 === void 0 ? void 0 : (_model$activeState2$g = _model$activeState2.getManipulator) === null || _model$activeState2$g === void 0 ? void 0 : _model$activeState2$g.call(_model$activeState2)) !== null && _model$activeState$ge3 !== void 0 ? _model$activeState$ge3 : model.manipulator;
68
63
 
69
64
  if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
70
65
  var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
71
66
 
72
- if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
67
+ if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || model._isDragging) && model.activeState.setOrigin // e.g. the line is pickable but not draggable
68
+ ) {
73
69
  model.activeState.setOrigin(worldCoords);
74
70
  publicAPI.invokeInteractionEvent();
75
71
  return macro.EVENT_ABORT;
@@ -83,27 +79,35 @@ function widgetBehavior(publicAPI, model) {
83
79
 
84
80
 
85
81
  publicAPI.handleLeftButtonRelease = function () {
86
- if (isDragging && model.pickable) {
82
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
83
+ return macro.VOID;
84
+ }
85
+
86
+ if (model.hasFocus && model.widgetState.getHandleList().length === MAX_POINTS) {
87
+ publicAPI.loseFocus();
88
+ return macro.VOID;
89
+ }
90
+
91
+ if (model._isDragging) {
87
92
  model._apiSpecificRenderWindow.setCursor('pointer');
88
93
 
89
94
  model.widgetState.deactivate();
90
95
 
91
96
  model._interactor.cancelAnimation(publicAPI);
92
97
 
93
- publicAPI.invokeEndInteractionEvent();
98
+ model._isDragging = false;
94
99
  } else if (model.activeState !== model.widgetState.getMoveHandle()) {
95
100
  model.widgetState.deactivate();
96
101
  }
97
102
 
98
103
  if (model.hasFocus && !model.activeState || model.activeState && !model.activeState.getActive()) {
99
- publicAPI.invokeEndInteractionEvent();
100
-
101
104
  model._widgetManager.enablePicking();
102
105
 
103
106
  model._interactor.render();
104
107
  }
105
108
 
106
- isDragging = false;
109
+ publicAPI.invokeEndInteractionEvent();
110
+ return macro.EVENT_ABORT;
107
111
  }; // --------------------------------------------------------------------------
108
112
  // Focus API - modeHandle follow mouse when widget has focus
109
113
  // --------------------------------------------------------------------------
@@ -3,7 +3,7 @@ import macro from '../../../macros.js';
3
3
  import { handleTypeFromName, AXES, transformVec3, rotateVec3 } from './helpers.js';
4
4
 
5
5
  function widgetBehavior(publicAPI, model) {
6
- var isDragging = null;
6
+ model._isDragging = false;
7
7
 
8
8
  publicAPI.setDisplayCallback = function (callback) {
9
9
  return model.representations[0].setDisplayCallback(callback);
@@ -14,15 +14,19 @@ function widgetBehavior(publicAPI, model) {
14
14
  return macro.VOID;
15
15
  }
16
16
 
17
- isDragging = true;
17
+ if (model.dragable) {
18
+ model._isDragging = true;
18
19
 
19
- model._interactor.requestAnimation(publicAPI);
20
+ model._apiSpecificRenderWindow.setCursor('grabbing');
21
+
22
+ model._interactor.requestAnimation(publicAPI);
23
+ }
20
24
 
21
25
  return macro.EVENT_ABORT;
22
26
  };
23
27
 
24
28
  publicAPI.handleMouseMove = function (callData) {
25
- if (isDragging && model.pickable && model.dragable) {
29
+ if (model._isDragging) {
26
30
  return publicAPI.handleEvent(callData);
27
31
  }
28
32
 
@@ -30,13 +34,19 @@ function widgetBehavior(publicAPI, model) {
30
34
  };
31
35
 
32
36
  publicAPI.handleLeftButtonRelease = function () {
33
- if (isDragging && model.pickable) {
34
- isDragging = false;
37
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
38
+ return macro.VOID;
39
+ }
40
+
41
+ if (model._isDragging) {
42
+ model._isDragging = false;
35
43
 
36
44
  model._interactor.cancelAnimation(publicAPI);
37
45
 
38
46
  model.widgetState.deactivate();
39
47
  }
48
+
49
+ return macro.EVENT_ABORT;
40
50
  };
41
51
 
42
52
  publicAPI.handleEvent = function (callData) {
@@ -12,7 +12,7 @@ import { ViewTypes } from '../Core/WidgetManager/Constants.js';
12
12
 
13
13
  function widgetBehavior(publicAPI, model) {
14
14
  model.classHierarchy.push('vtkPlaneWidget');
15
- var isDragging = null;
15
+ model._isDragging = false;
16
16
 
17
17
  publicAPI.setDisplayCallback = function (callback) {
18
18
  return model.representations[0].setDisplayCallback(callback);
@@ -47,19 +47,24 @@ function widgetBehavior(publicAPI, model) {
47
47
  return macro.VOID;
48
48
  }
49
49
 
50
- isDragging = true;
51
50
  model.lineManipulator.setWidgetOrigin(model.widgetState.getOrigin());
52
51
  model.planeManipulator.setWidgetOrigin(model.widgetState.getOrigin());
53
52
  model.trackballManipulator.reset(callData); // setup trackball delta
54
53
 
55
- model._interactor.requestAnimation(publicAPI);
54
+ if (model.dragable) {
55
+ model._isDragging = true;
56
+
57
+ model._apiSpecificRenderWindow.setCursor('grabbing');
58
+
59
+ model._interactor.requestAnimation(publicAPI);
60
+ }
56
61
 
57
62
  publicAPI.invokeStartInteractionEvent();
58
63
  return macro.EVENT_ABORT;
59
64
  };
60
65
 
61
66
  publicAPI.handleMouseMove = function (callData) {
62
- if (isDragging && model.pickable) {
67
+ if (model._isDragging) {
63
68
  return publicAPI.handleEvent(callData);
64
69
  }
65
70
 
@@ -67,14 +72,19 @@ function widgetBehavior(publicAPI, model) {
67
72
  };
68
73
 
69
74
  publicAPI.handleLeftButtonRelease = function () {
70
- if (isDragging && model.pickable) {
71
- publicAPI.invokeEndInteractionEvent();
75
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
76
+ return macro.VOID;
77
+ }
72
78
 
79
+ if (model._isDragging) {
73
80
  model._interactor.cancelAnimation(publicAPI);
81
+
82
+ model._isDragging = false;
74
83
  }
75
84
 
76
- isDragging = false;
77
85
  model.widgetState.deactivate();
86
+ publicAPI.invokeEndInteractionEvent();
87
+ return macro.EVENT_ABORT;
78
88
  };
79
89
 
80
90
  publicAPI.handleEvent = function (callData) {
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
6
6
  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; }
7
7
  function widgetBehavior(publicAPI, model) {
8
8
  model.classHierarchy.push('vtkLabelWidgetProp');
9
- model.isDragging = null; // --------------------------------------------------------------------------
9
+ model._isDragging = false; // --------------------------------------------------------------------------
10
10
  // Public methods
11
11
  // --------------------------------------------------------------------------
12
12
 
@@ -56,8 +56,8 @@ function widgetBehavior(publicAPI, model) {
56
56
  moveHandle.setOrigin(worldCoords);
57
57
  model.widgetState.getText().setOrigin(moveHandle.getOrigin());
58
58
  publicAPI.loseFocus();
59
- } else {
60
- model.isDragging = true;
59
+ } else if (model.dragable) {
60
+ model._isDragging = true;
61
61
 
62
62
  model._apiSpecificRenderWindow.setCursor('grabbing');
63
63
 
@@ -72,27 +72,30 @@ function widgetBehavior(publicAPI, model) {
72
72
 
73
73
 
74
74
  publicAPI.handleLeftButtonRelease = function () {
75
- if (model.isDragging && model.pickable) {
75
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
76
+ return macro.VOID;
77
+ }
78
+
79
+ if (model._isDragging) {
76
80
  model._apiSpecificRenderWindow.setCursor('pointer');
77
81
 
78
82
  model.widgetState.deactivate();
79
83
 
80
84
  model._interactor.cancelAnimation(publicAPI);
81
85
 
82
- publicAPI.invokeEndInteractionEvent();
86
+ model._isDragging = false;
83
87
  } else if (model.activeState !== model.widgetState.getMoveHandle()) {
84
88
  model.widgetState.deactivate();
85
89
  }
86
90
 
87
91
  if (model.hasFocus && !model.activeState || model.activeState && !model.activeState.getActive()) {
88
- publicAPI.invokeEndInteractionEvent();
89
-
90
92
  model._widgetManager.enablePicking();
91
93
 
92
94
  model._interactor.render();
93
95
  }
94
96
 
95
- model.isDragging = false;
97
+ publicAPI.invokeEndInteractionEvent();
98
+ return macro.EVENT_ABORT;
96
99
  }; // --------------------------------------------------------------------------
97
100
  // Mouse move: Drag selected handle / Handle follow the mouse
98
101
  // --------------------------------------------------------------------------
@@ -106,7 +109,7 @@ function widgetBehavior(publicAPI, model) {
106
109
  if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
107
110
  var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
108
111
 
109
- if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || model.isDragging)) {
112
+ if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || model._isDragging)) {
110
113
  model.activeState.setOrigin(worldCoords);
111
114
  model.widgetState.getText().setOrigin(model.activeState.getOrigin());
112
115
  publicAPI.invokeInteractionEvent();
@@ -14,6 +14,7 @@ var MAX_POINTS = 2;
14
14
  var handleGetters = ['getHandle1', 'getHandle2', 'getMoveHandle'];
15
15
  function widgetBehavior(publicAPI, model) {
16
16
  model.classHierarchy.push('vtkLineWidgetProp');
17
+ model._isDragging = false;
17
18
  /**
18
19
  * Returns the handle at the handleIndex'th index.
19
20
  * @param {number} handleIndex 0, 1 or 2
@@ -37,7 +38,7 @@ function widgetBehavior(publicAPI, model) {
37
38
  function updateCursor(callData) {
38
39
  var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
39
40
 
40
- model.isDragging = true;
41
+ model._isDragging = true;
41
42
  var manipulator = (_model$activeState$ge = (_model$activeState = model.activeState) === null || _model$activeState === void 0 ? void 0 : (_model$activeState$ge2 = _model$activeState.getManipulator) === null || _model$activeState$ge2 === void 0 ? void 0 : _model$activeState$ge2.call(_model$activeState)) !== null && _model$activeState$ge !== void 0 ? _model$activeState$ge : model.manipulator;
42
43
  model.previousPosition = _toConsumableArray(manipulator.handleEvent(callData, model._apiSpecificRenderWindow));
43
44
 
@@ -212,7 +213,7 @@ function widgetBehavior(publicAPI, model) {
212
213
  publicAPI.placeHandle(0);
213
214
  } else if (model.widgetState.getMoveHandle().getActive() && getNumberOfPlacedHandles(model.widgetState) === 1) {
214
215
  publicAPI.placeHandle(1);
215
- } else if (!model.widgetState.getText().getActive()) {
216
+ } else if (model.dragable && !model.widgetState.getText().getActive()) {
216
217
  // Grab handle1, handle2 or whole widget
217
218
  updateCursor(e);
218
219
  }
@@ -227,11 +228,6 @@ function widgetBehavior(publicAPI, model) {
227
228
  publicAPI.handleMouseMove = function (callData) {
228
229
  var _model$activeState$ge3, _model$activeState2, _model$activeState2$g;
229
230
 
230
- if (model.hasFocus && publicAPI.isPlaced() && !model.isDragging) {
231
- publicAPI.loseFocus();
232
- return macro.VOID;
233
- }
234
-
235
231
  var manipulator = (_model$activeState$ge3 = (_model$activeState2 = model.activeState) === null || _model$activeState2 === void 0 ? void 0 : (_model$activeState2$g = _model$activeState2.getManipulator) === null || _model$activeState2$g === void 0 ? void 0 : _model$activeState2$g.call(_model$activeState2)) !== null && _model$activeState$ge3 !== void 0 ? _model$activeState$ge3 : model.manipulator;
236
232
 
237
233
  if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
@@ -241,7 +237,7 @@ function widgetBehavior(publicAPI, model) {
241
237
 
242
238
  if ( // is placing first or second handle
243
239
  model.activeState === model.widgetState.getMoveHandle() || // is dragging already placed first or second handle
244
- model.isDragging) {
240
+ model._isDragging) {
245
241
  if (model.activeState.setOrigin) {
246
242
  model.activeState.setOrigin(worldCoords);
247
243
  } else {
@@ -259,18 +255,26 @@ function widgetBehavior(publicAPI, model) {
259
255
 
260
256
  return macro.VOID;
261
257
  }; // --------------------------------------------------------------------------
262
- // Left release: Finish drag / Create new handle
258
+ // Left release: Finish drag
263
259
  // --------------------------------------------------------------------------
264
260
 
265
261
 
266
262
  publicAPI.handleLeftButtonRelease = function () {
267
- // After dragging a point or placing all points
268
- if (model.activeState && model.activeState.getActive() && (model.isDragging || publicAPI.isPlaced())) {
263
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
264
+ publicAPI.rotateHandlesToFaceCamera();
265
+ return macro.VOID;
266
+ }
267
+
268
+ if (model.hasFocus && publicAPI.isPlaced()) {
269
+ publicAPI.loseFocus();
270
+ return macro.VOID;
271
+ }
272
+
273
+ if (model._isDragging && publicAPI.isPlaced()) {
269
274
  var wasTextActive = model.widgetState.getText().getActive(); // Recompute offsets
270
275
 
271
276
  publicAPI.placeText();
272
277
  model.widgetState.deactivate();
273
- model.widgetState.getMoveHandle().deactivate();
274
278
  model.activeState = null;
275
279
 
276
280
  if (!wasTextActive) {
@@ -280,18 +284,19 @@ function widgetBehavior(publicAPI, model) {
280
284
  model._apiSpecificRenderWindow.setCursor('pointer');
281
285
 
282
286
  model.hasFocus = false;
283
- publicAPI.invokeEndInteractionEvent();
287
+ model._isDragging = false;
288
+ } else if (model.activeState !== model.widgetState.getMoveHandle()) {
289
+ model.widgetState.deactivate();
290
+ }
284
291
 
292
+ if (model.hasFocus && !model.activeState || model.activeState && !model.activeState.getActive()) {
285
293
  model._widgetManager.enablePicking();
286
294
 
287
295
  model._interactor.render();
288
296
  }
289
297
 
290
- if (model.isDragging === false && (!model.activeState || !model.activeState.getActive())) {
291
- publicAPI.rotateHandlesToFaceCamera();
292
- }
293
-
294
- model.isDragging = false;
298
+ publicAPI.invokeEndInteractionEvent();
299
+ return macro.EVENT_ABORT;
295
300
  }; // --------------------------------------------------------------------------
296
301
  // Focus API - moveHandle follow mouse when widget has focus
297
302
  // --------------------------------------------------------------------------
@@ -172,16 +172,14 @@ function vtkLineWidget(publicAPI, model) {
172
172
  } // ----------------------------------------------------------------------------
173
173
 
174
174
 
175
- var DEFAULT_VALUES = {
176
- // manipulator: null,
177
- isDragging: false
175
+ var DEFAULT_VALUES = {// manipulator: null,
178
176
  }; // ----------------------------------------------------------------------------
179
177
 
180
178
  function extend(publicAPI, model) {
181
179
  var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
182
180
  Object.assign(model, DEFAULT_VALUES, initialValues);
183
181
  vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
184
- macro.setGet(publicAPI, model, ['manipulator', 'isDragging']);
182
+ macro.setGet(publicAPI, model, ['manipulator']);
185
183
  vtkLineWidget(publicAPI, model);
186
184
  } // ----------------------------------------------------------------------------
187
185
 
@@ -2,7 +2,7 @@ import macro from '../../../macros.js';
2
2
 
3
3
  function widgetBehavior(publicAPI, model) {
4
4
  model.classHierarchy.push('vtkPolyLineWidgetProp');
5
- var isDragging = null; // --------------------------------------------------------------------------
5
+ model._isDragging = false; // --------------------------------------------------------------------------
6
6
  // Display 2D
7
7
  // --------------------------------------------------------------------------
8
8
 
@@ -28,7 +28,8 @@ function widgetBehavior(publicAPI, model) {
28
28
 
29
29
  var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
30
30
 
31
- if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || isDragging)) {
31
+ if (worldCoords.length && (model.activeState === model.widgetState.getMoveHandle() || model._isDragging) && model.activeState.setOrigin // e.g. the line is pickable but not draggable
32
+ ) {
32
33
  model.activeState.setOrigin(worldCoords);
33
34
  publicAPI.invokeInteractionEvent();
34
35
  return macro.EVENT_ABORT;
@@ -81,8 +82,8 @@ function widgetBehavior(publicAPI, model) {
81
82
  newHandle.setColor(moveHandle.getColor());
82
83
  newHandle.setScale1(moveHandle.getScale1());
83
84
  newHandle.setManipulator(manipulator);
84
- } else {
85
- isDragging = true;
85
+ } else if (model.dragable) {
86
+ model._isDragging = true;
86
87
 
87
88
  model._apiSpecificRenderWindow.setCursor('grabbing');
88
89
 
@@ -114,27 +115,30 @@ function widgetBehavior(publicAPI, model) {
114
115
 
115
116
 
116
117
  publicAPI.handleLeftButtonRelease = function () {
117
- if (isDragging && model.pickable) {
118
+ if (!model.activeState || !model.activeState.getActive() || !model.pickable) {
119
+ return macro.VOID;
120
+ }
121
+
122
+ if (model._isDragging) {
118
123
  model._apiSpecificRenderWindow.setCursor('pointer');
119
124
 
120
125
  model.widgetState.deactivate();
121
126
 
122
127
  model._interactor.cancelAnimation(publicAPI);
123
128
 
124
- publicAPI.invokeEndInteractionEvent();
129
+ model._isDragging = false;
125
130
  } else if (model.activeState !== model.widgetState.getMoveHandle()) {
126
131
  model.widgetState.deactivate();
127
132
  }
128
133
 
129
134
  if (model.hasFocus && !model.activeState || model.activeState && !model.activeState.getActive()) {
130
- publicAPI.invokeEndInteractionEvent();
131
-
132
135
  model._widgetManager.enablePicking();
133
136
 
134
137
  model._interactor.render();
135
138
  }
136
139
 
137
- isDragging = false;
140
+ publicAPI.invokeEndInteractionEvent();
141
+ return macro.EVENT_ABORT;
138
142
  }; // --------------------------------------------------------------------------
139
143
  // Escape key: Release focus to switch to drag mode
140
144
  // --------------------------------------------------------------------------
@@ -8,7 +8,7 @@ import { updateState, getAssociatedLinesName, boundPointOnPlane, rotateVector }
8
8
  import { InteractionMethodsName, ScrollingMethods } from './Constants.js';
9
9
 
10
10
  function widgetBehavior(publicAPI, model) {
11
- var isDragging = null;
11
+ model._isDragging = false;
12
12
  var isScrolling = false; // Reset "updateMethodName" attribute when no actors are selected
13
13
  // Useful to update 'updateMethodeName' to the correct name which
14
14
  // will be TranslateCenter by default
@@ -60,7 +60,7 @@ function widgetBehavior(publicAPI, model) {
60
60
 
61
61
  publicAPI.handleLeftButtonPress = function (callData) {
62
62
  if (model.activeState && model.activeState.getActive()) {
63
- isDragging = true;
63
+ model._isDragging = true;
64
64
  var viewType = model.widgetState.getActiveViewType();
65
65
  var currentPlaneNormal = model.widgetState.getPlanes()[viewType].normal;
66
66
  model.planeManipulator.setWidgetOrigin(model.widgetState.getCenter());
@@ -76,7 +76,7 @@ function widgetBehavior(publicAPI, model) {
76
76
  };
77
77
 
78
78
  publicAPI.handleMouseMove = function (callData) {
79
- if (isDragging && model.pickable && model.dragable) {
79
+ if (model._isDragging) {
80
80
  return publicAPI.handleEvent(callData);
81
81
  }
82
82
 
@@ -93,11 +93,11 @@ function widgetBehavior(publicAPI, model) {
93
93
  };
94
94
 
95
95
  publicAPI.handleLeftButtonRelease = function () {
96
- if (isDragging || isScrolling) {
96
+ if (model._isDragging || isScrolling) {
97
97
  publicAPI.endScrolling();
98
98
  }
99
99
 
100
- isDragging = false;
100
+ model._isDragging = false;
101
101
  model.widgetState.deactivate();
102
102
  };
103
103
 
@@ -15,6 +15,7 @@ var vtkErrorMacro = macro.vtkErrorMacro;
15
15
  var EPSILON = 1e-6;
16
16
  function widgetBehavior(publicAPI, model) {
17
17
  model.classHierarchy.push('vtkShapeWidgetProp');
18
+ model._isDragging = false;
18
19
  model.keysDown = {};
19
20
 
20
21
  var superClass = _objectSpread({}, publicAPI); // --------------------------------------------------------------------------
@@ -383,7 +384,7 @@ function widgetBehavior(publicAPI, model) {
383
384
  publicAPI.updateShapeBounds();
384
385
  publicAPI.invokeInteractionEvent();
385
386
  }
386
- } else if (model.isDragging) {
387
+ } else if (model._isDragging) {
387
388
  if (model.activeState === model.point1Handle) {
388
389
  model.point1Handle.setOrigin(worldCoords);
389
390
  model.point1 = worldCoords;
@@ -396,7 +397,7 @@ function widgetBehavior(publicAPI, model) {
396
397
  publicAPI.invokeInteractionEvent();
397
398
  }
398
399
 
399
- return model.hasFocus || model.isDragging ? macro.EVENT_ABORT : macro.VOID;
400
+ return model.hasFocus || model._isDragging ? macro.EVENT_ABORT : macro.VOID;
400
401
  }; // --------------------------------------------------------------------------
401
402
  // Left click: Add point / End interaction
402
403
  // --------------------------------------------------------------------------
@@ -434,26 +435,24 @@ function widgetBehavior(publicAPI, model) {
434
435
  return macro.EVENT_ABORT;
435
436
  }
436
437
 
437
- if (model.point1 && (model.activeState === model.point1Handle || model.activeState === model.point2Handle)) {
438
- model.isDragging = true;
438
+ if (model.point1 && (model.activeState === model.point1Handle || model.activeState === model.point2Handle) && model.dragable) {
439
+ model._isDragging = true;
439
440
 
440
441
  model._apiSpecificRenderWindow.setCursor('grabbing');
441
442
 
442
443
  model._interactor.requestAnimation(publicAPI);
443
-
444
- publicAPI.invokeStartInteractionEvent();
445
- return macro.EVENT_ABORT;
446
444
  }
447
445
 
448
- return macro.VOID;
446
+ publicAPI.invokeStartInteractionEvent();
447
+ return macro.EVENT_ABORT;
449
448
  }; // --------------------------------------------------------------------------
450
449
  // Left release: Maybe end interaction
451
450
  // --------------------------------------------------------------------------
452
451
 
453
452
 
454
453
  publicAPI.handleLeftButtonRelease = function (e) {
455
- if (model.isDragging) {
456
- model.isDragging = false;
454
+ if (model._isDragging) {
455
+ model._isDragging = false;
457
456
 
458
457
  model._apiSpecificRenderWindow.setCursor('pointer');
459
458
 
@@ -9,7 +9,7 @@ function widgetBehavior(publicAPI, model) {
9
9
  var borderHandle = state.getBorderHandle();
10
10
  var shapeHandle = state.getSphereHandle(); // Set while moving the center or border handle.
11
11
 
12
- model.isDragging = false; // The last world coordinate of the mouse cursor during dragging.
12
+ model._isDragging = false; // The last world coordinate of the mouse cursor during dragging.
13
13
 
14
14
  model.previousPosition = null;
15
15
  model.classHierarchy.push('vtkSphereWidgetProp');
@@ -103,7 +103,7 @@ function widgetBehavior(publicAPI, model) {
103
103
  updateSphere();
104
104
  }
105
105
 
106
- model.isDragging = true;
106
+ model._isDragging = true;
107
107
 
108
108
  model._apiSpecificRenderWindow.setCursor('grabbing');
109
109
 
@@ -113,7 +113,7 @@ function widgetBehavior(publicAPI, model) {
113
113
  };
114
114
 
115
115
  publicAPI.handleLeftButtonRelease = function (e) {
116
- if (!model.isDragging) {
116
+ if (!model._isDragging) {
117
117
  model.activeState = null;
118
118
  return macro.VOID;
119
119
  }
@@ -125,7 +125,7 @@ function widgetBehavior(publicAPI, model) {
125
125
 
126
126
  model._apiSpecificRenderWindow.setCursor('pointer');
127
127
 
128
- model.isDragging = false;
128
+ model._isDragging = false;
129
129
  model.activeState = null;
130
130
  state.deactivate();
131
131
  }
@@ -135,7 +135,7 @@ function widgetBehavior(publicAPI, model) {
135
135
  };
136
136
 
137
137
  publicAPI.handleMouseMove = function (e) {
138
- if (!model.isDragging) {
138
+ if (!model._isDragging) {
139
139
  model.activeState = null;
140
140
  return macro.VOID;
141
141
  }
@@ -171,14 +171,14 @@ function widgetBehavior(publicAPI, model) {
171
171
  borderHandle.setVisible(false);
172
172
  centerHandle.setOrigin(null);
173
173
  borderHandle.setOrigin(null);
174
- model.isDragging = true;
174
+ model._isDragging = true;
175
175
  model.activeState = moveHandle;
176
176
 
177
177
  model._interactor.render();
178
178
  };
179
179
 
180
180
  publicAPI.loseFocus = function () {
181
- model.isDragging = false;
181
+ model._isDragging = false;
182
182
  model.activeState = null;
183
183
  };
184
184
  }
@@ -4,6 +4,7 @@ import { vec3 } from 'gl-matrix';
4
4
 
5
5
  function widgetBehavior(publicAPI, model) {
6
6
  model.classHierarchy.push('vtkSplineWidgetProp');
7
+ model._isDragging = false;
7
8
  model.keysDown = {};
8
9
  model.moveHandle = model.widgetState.getMoveHandle(); // --------------------------------------------------------------------------
9
10
  // Private methods
@@ -166,7 +167,6 @@ function widgetBehavior(publicAPI, model) {
166
167
 
167
168
  if (model.activeState === model.moveHandle) {
168
169
  if (model.widgetState.getHandleList().length === 0) {
169
- publicAPI.invokeStartInteractionEvent();
170
170
  addPoint();
171
171
  } else {
172
172
  var hoveredHandle = getHoveredHandle();
@@ -176,24 +176,23 @@ function widgetBehavior(publicAPI, model) {
176
176
  model.moveHandle.setVisible(false);
177
177
  model.activeState = hoveredHandle;
178
178
  hoveredHandle.activate();
179
- model.isDragging = true;
179
+ model._isDragging = true;
180
180
  model.lastHandle.setVisible(true);
181
181
  } else {
182
182
  addPoint();
183
183
  }
184
184
  }
185
185
 
186
- model.freeHand = publicAPI.getAllowFreehand() && !model.isDragging;
187
- } else {
188
- model.isDragging = true;
186
+ model.freeHand = publicAPI.getAllowFreehand() && !model._isDragging;
187
+ } else if (model.dragable) {
188
+ model._isDragging = true;
189
189
 
190
190
  model._apiSpecificRenderWindow.setCursor('grabbing');
191
191
 
192
192
  model._interactor.requestAnimation(publicAPI);
193
-
194
- publicAPI.invokeStartInteractionEvent();
195
193
  }
196
194
 
195
+ publicAPI.invokeStartInteractionEvent();
197
196
  return macro.EVENT_ABORT;
198
197
  }; // --------------------------------------------------------------------------
199
198
  // Left release
@@ -201,7 +200,7 @@ function widgetBehavior(publicAPI, model) {
201
200
 
202
201
 
203
202
  publicAPI.handleLeftButtonRelease = function (e) {
204
- if (model.isDragging) {
203
+ if (model._isDragging) {
205
204
  if (!model.hasFocus) {
206
205
  model._apiSpecificRenderWindow.setCursor(model.defaultCursor);
207
206
 
@@ -239,8 +238,8 @@ function widgetBehavior(publicAPI, model) {
239
238
  }
240
239
 
241
240
  model.freeHand = false;
242
- model.isDragging = false;
243
241
  model.draggedPoint = false;
242
+ model._isDragging = false;
244
243
  return model.hasFocus ? macro.EVENT_ABORT : macro.VOID;
245
244
  }; // --------------------------------------------------------------------------
246
245
  // Mouse move: Drag selected handle / Handle follow the mouse
@@ -265,7 +264,7 @@ function widgetBehavior(publicAPI, model) {
265
264
  if (hoveredHandle !== model.firstHandle) {
266
265
  model._apiSpecificRenderWindow.setCursor('grabbing');
267
266
  }
268
- } else if (!model.isDragging && model.hasFocus) {
267
+ } else if (!model._isDragging && model.hasFocus) {
269
268
  model.moveHandle.setVisible(true);
270
269
 
271
270
  model._apiSpecificRenderWindow.setCursor(model.defaultCursor);
@@ -275,10 +274,10 @@ function widgetBehavior(publicAPI, model) {
275
274
  model.lastHandle.setVisible(true);
276
275
  }
277
276
 
278
- if (worldCoords.length && (model.isDragging || model.activeState === model.moveHandle)) {
277
+ if (worldCoords.length && (model._isDragging || model.activeState === model.moveHandle)) {
279
278
  model.activeState.setOrigin(worldCoords);
280
279
 
281
- if (model.isDragging) {
280
+ if (model._isDragging) {
282
281
  model.draggedPoint = true;
283
282
  }
284
283
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.18.8",
3
+ "version": "24.18.9",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",