@kitware/vtk.js 24.18.6 → 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.
- package/Common/DataModel/DataSet/Constants.d.ts +27 -0
- package/Common/DataModel/DataSet.d.ts +6 -31
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +1 -1
- package/Rendering/Core/CellPicker.js +9 -2
- package/Rendering/Core/InteractorObserver.d.ts +132 -0
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +80 -0
- package/Rendering/Misc/SynchronizableRenderWindow/{vtkObjectManager.js → ObjectManager.js} +0 -0
- package/Rendering/Misc/SynchronizableRenderWindow.js +1 -1
- package/Rendering/OpenGL/ImageMapper.js +4 -0
- package/Widgets/Core/AbstractWidget.d.ts +187 -0
- package/Widgets/Core/AbstractWidgetFactory.d.ts +126 -0
- package/Widgets/Core/WidgetManager/Constants.d.ts +27 -0
- package/Widgets/Core/WidgetManager.d.ts +216 -0
- package/Widgets/Core/WidgetState.d.ts +81 -0
- package/Widgets/Widgets3D/AngleWidget/behavior.js +18 -14
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +18 -14
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +16 -6
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +17 -7
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +40 -0
- package/Widgets/Widgets3D/LabelWidget/behavior.js +12 -9
- package/Widgets/Widgets3D/LineWidget/behavior.js +23 -18
- package/Widgets/Widgets3D/LineWidget.js +2 -4
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +13 -9
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +12 -14
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -10
- package/Widgets/Widgets3D/SphereWidget/behavior.js +7 -7
- package/Widgets/Widgets3D/SplineWidget/behavior.js +11 -12
- package/index.d.ts +9 -0
- package/interfaces.d.ts +3 -0
- package/package.json +2 -2
|
@@ -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.
|
|
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.
|
|
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
|
|
258
|
+
// Left release: Finish drag
|
|
263
259
|
// --------------------------------------------------------------------------
|
|
264
260
|
|
|
265
261
|
|
|
266
262
|
publicAPI.handleLeftButtonRelease = function () {
|
|
267
|
-
|
|
268
|
-
|
|
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
|
-
|
|
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
|
-
|
|
291
|
-
|
|
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'
|
|
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
|
-
|
|
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() ||
|
|
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
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
140
|
+
publicAPI.invokeEndInteractionEvent();
|
|
141
|
+
return macro.EVENT_ABORT;
|
|
138
142
|
}; // --------------------------------------------------------------------------
|
|
139
143
|
// Escape key: Release focus to switch to drag mode
|
|
140
144
|
// --------------------------------------------------------------------------
|
|
@@ -3,12 +3,12 @@ import macro from '../../../macros.js';
|
|
|
3
3
|
import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
|
|
4
4
|
import vtkLine from '../../../Common/DataModel/Line.js';
|
|
5
5
|
import vtkPlanePointManipulator from '../../Manipulators/PlaneManipulator.js';
|
|
6
|
-
import {
|
|
6
|
+
import { s as subtract, l as normalize, d as dot, j as cross, m as multiplyAccumulate, x as multiplyScalar, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
7
|
import { updateState, getAssociatedLinesName, boundPointOnPlane, rotateVector } from './helpers.js';
|
|
8
8
|
import { InteractionMethodsName, ScrollingMethods } from './Constants.js';
|
|
9
9
|
|
|
10
10
|
function widgetBehavior(publicAPI, model) {
|
|
11
|
-
|
|
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
|
-
|
|
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,14 +76,14 @@ function widgetBehavior(publicAPI, model) {
|
|
|
76
76
|
};
|
|
77
77
|
|
|
78
78
|
publicAPI.handleMouseMove = function (callData) {
|
|
79
|
-
if (
|
|
79
|
+
if (model._isDragging) {
|
|
80
80
|
return publicAPI.handleEvent(callData);
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
if (isScrolling) {
|
|
84
84
|
if (model.previousPosition.y !== callData.position.y) {
|
|
85
85
|
var step = model.previousPosition.y - callData.position.y;
|
|
86
|
-
publicAPI.
|
|
86
|
+
publicAPI.translateCenterOnPlaneDirection(step);
|
|
87
87
|
model.previousPosition = callData.position;
|
|
88
88
|
publicAPI.invokeInternalInteractionEvent();
|
|
89
89
|
}
|
|
@@ -93,11 +93,11 @@ function widgetBehavior(publicAPI, model) {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
publicAPI.handleLeftButtonRelease = function () {
|
|
96
|
-
if (
|
|
96
|
+
if (model._isDragging || isScrolling) {
|
|
97
97
|
publicAPI.endScrolling();
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
model._isDragging = false;
|
|
101
101
|
model.widgetState.deactivate();
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -121,7 +121,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
121
121
|
publicAPI.handleMouseWheel = function (calldata) {
|
|
122
122
|
var step = calldata.spinY;
|
|
123
123
|
isScrolling = true;
|
|
124
|
-
publicAPI.
|
|
124
|
+
publicAPI.translateCenterOnPlaneDirection(step);
|
|
125
125
|
publicAPI.invokeInternalInteractionEvent();
|
|
126
126
|
isScrolling = false;
|
|
127
127
|
return macro.EVENT_ABORT;
|
|
@@ -178,10 +178,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
publicAPI.
|
|
182
|
-
var dirProj =
|
|
183
|
-
|
|
184
|
-
var direction = multiplyScalar(dirProj, -1);
|
|
181
|
+
publicAPI.translateCenterOnPlaneDirection = function (nbSteps) {
|
|
182
|
+
var dirProj = model.widgetState.getPlanes()[model.viewType].normal;
|
|
185
183
|
var oldCenter = model.widgetState.getCenter();
|
|
186
184
|
var image = model.widgetState.getImage();
|
|
187
185
|
var imageSpacing = image.getSpacing(); // Use Chebyshev norm
|
|
@@ -191,9 +189,9 @@ function widgetBehavior(publicAPI, model) {
|
|
|
191
189
|
return Math.abs(value);
|
|
192
190
|
});
|
|
193
191
|
var index = absDirProj.indexOf(Math.max.apply(Math, _toConsumableArray(absDirProj)));
|
|
194
|
-
var movingFactor = nbSteps *
|
|
192
|
+
var movingFactor = nbSteps * imageSpacing[index] / Math.abs(dirProj[index]); // Define the potentially new center
|
|
195
193
|
|
|
196
|
-
var newCenter = [oldCenter[0] + movingFactor *
|
|
194
|
+
var newCenter = [oldCenter[0] + movingFactor * dirProj[0], oldCenter[1] + movingFactor * dirProj[1], oldCenter[2] + movingFactor * dirProj[2]];
|
|
197
195
|
newCenter = publicAPI.getBoundedCenter(newCenter);
|
|
198
196
|
model.widgetState.setCenter(newCenter);
|
|
199
197
|
updateState(model.widgetState);
|
|
@@ -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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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.
|
|
456
|
-
model.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
187
|
-
} else {
|
|
188
|
-
model.
|
|
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.
|
|
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.
|
|
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.
|
|
277
|
+
if (worldCoords.length && (model._isDragging || model.activeState === model.moveHandle)) {
|
|
279
278
|
model.activeState.setOrigin(worldCoords);
|
|
280
279
|
|
|
281
|
-
if (model.
|
|
280
|
+
if (model._isDragging) {
|
|
282
281
|
model.draggedPoint = true;
|
|
283
282
|
}
|
|
284
283
|
|
package/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
/// <reference path="./Common/DataModel/Cell.d.ts" />
|
|
22
22
|
/// <reference path="./Common/DataModel/Cone.d.ts" />
|
|
23
23
|
/// <reference path="./Common/DataModel/Cylinder.d.ts" />
|
|
24
|
+
/// <reference path="./Common/DataModel/DataSet/Constants.d.ts" />
|
|
24
25
|
/// <reference path="./Common/DataModel/DataSet.d.ts" />
|
|
25
26
|
/// <reference path="./Common/DataModel/DataSetAttributes/FieldData.d.ts" />
|
|
26
27
|
/// <reference path="./Common/DataModel/DataSetAttributes.d.ts" />
|
|
@@ -114,6 +115,7 @@
|
|
|
114
115
|
/// <reference path="./Rendering/Core/ImageProperty/Constants.d.ts" />
|
|
115
116
|
/// <reference path="./Rendering/Core/ImageProperty.d.ts" />
|
|
116
117
|
/// <reference path="./Rendering/Core/ImageSlice.d.ts" />
|
|
118
|
+
/// <reference path="./Rendering/Core/InteractorObserver.d.ts" />
|
|
117
119
|
/// <reference path="./Rendering/Core/Light.d.ts" />
|
|
118
120
|
/// <reference path="./Rendering/Core/Mapper/Constants.d.ts" />
|
|
119
121
|
/// <reference path="./Rendering/Core/Mapper.d.ts" />
|
|
@@ -147,18 +149,25 @@
|
|
|
147
149
|
/// <reference path="./Rendering/Misc/GenericRenderWindow.d.ts" />
|
|
148
150
|
/// <reference path="./Rendering/Misc/RemoteView.d.ts" />
|
|
149
151
|
/// <reference path="./Rendering/Misc/RenderWindowWithControlBar.d.ts" />
|
|
152
|
+
/// <reference path="./Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts" />
|
|
150
153
|
/// <reference path="./Rendering/Misc/SynchronizableRenderWindow.d.ts" />
|
|
151
154
|
/// <reference path="./Rendering/Misc/TextureLODsDownloader.d.ts" />
|
|
152
155
|
/// <reference path="./Rendering/OpenGL/RenderWindow.d.ts" />
|
|
153
156
|
/// <reference path="./Rendering/SceneGraph/RenderPass.d.ts" />
|
|
154
157
|
/// <reference path="./Rendering/SceneGraph/ViewNode.d.ts" />
|
|
155
158
|
/// <reference path="./Rendering/SceneGraph/ViewNodeFactory.d.ts" />
|
|
159
|
+
/// <reference path="./Widgets/Core/AbstractWidget.d.ts" />
|
|
160
|
+
/// <reference path="./Widgets/Core/AbstractWidgetFactory.d.ts" />
|
|
161
|
+
/// <reference path="./Widgets/Core/WidgetManager/Constants.d.ts" />
|
|
162
|
+
/// <reference path="./Widgets/Core/WidgetManager.d.ts" />
|
|
163
|
+
/// <reference path="./Widgets/Core/WidgetState.d.ts" />
|
|
156
164
|
/// <reference path="./Widgets/Manipulators/AbstractManipulator.d.ts" />
|
|
157
165
|
/// <reference path="./Widgets/Manipulators/LineManipulator.d.ts" />
|
|
158
166
|
/// <reference path="./Widgets/Manipulators/PlaneManipulator.d.ts" />
|
|
159
167
|
/// <reference path="./Widgets/Manipulators/TrackballManipulator.d.ts" />
|
|
160
168
|
/// <reference path="./Widgets/Representations/ResliceCursorContextRepresentation.d.ts" />
|
|
161
169
|
/// <reference path="./Widgets/Representations/WidgetRepresentation.d.ts" />
|
|
170
|
+
/// <reference path="./Widgets/Widgets3D/InteractiveOrientationWidget.d.ts" />
|
|
162
171
|
/// <reference path="./Widgets/Widgets3D/SphereWidget.d.ts" />
|
|
163
172
|
/// <reference path="./macros.d.ts" />
|
|
164
173
|
/// <reference path="./vtk.d.ts" />
|
package/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import vtkDataArray from './Common/Core/DataArray';
|
|
2
2
|
import { vtkPipelineConnection } from './types';
|
|
3
|
+
import { EVENT_ABORT, VOID } from './macros';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Object returned on any subscription call
|
|
@@ -278,3 +279,5 @@ export interface vtkProperty {
|
|
|
278
279
|
}
|
|
279
280
|
|
|
280
281
|
export interface vtkPropertyDomain {}
|
|
282
|
+
|
|
283
|
+
export type EventHandler = (...args: unknown[]) => typeof EVENT_ABORT | typeof VOID | void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitware/vtk.js",
|
|
3
|
-
"version": "24.18.
|
|
3
|
+
"version": "24.18.9",
|
|
4
4
|
"description": "Visualization Toolkit for the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"rollup-plugin-string": "3.0.0",
|
|
113
113
|
"rollup-plugin-svgo": "1.1.0",
|
|
114
114
|
"rollup-plugin-web-worker-loader": "1.6.1",
|
|
115
|
-
"semantic-release": "19.0.
|
|
115
|
+
"semantic-release": "19.0.3",
|
|
116
116
|
"string-replace-loader": "3.1.0",
|
|
117
117
|
"style-loader": "3.3.1",
|
|
118
118
|
"tape": "5.5.3",
|