@kitware/vtk.js 24.6.0 → 24.8.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.
- package/IO/XML/XMLImageDataReader.js +6 -0
- package/IO/XML/XMLImageDataWriter.js +2 -1
- package/Interaction/Manipulators/MouseCameraAxisRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballMultiRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballPanManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballRotateManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraTrackballZoomManipulator.js +1 -1
- package/Interaction/Manipulators/MouseCameraUnicamManipulator.js +5 -2
- package/Interaction/Manipulators/MouseCameraUnicamRotateManipulator.js +3 -1
- package/Interaction/Style/InteractorStyleManipulator.js +1 -1
- package/Rendering/Core/RenderWindowInteractor.js +1 -2
- package/Rendering/Core/Renderer.d.ts +1 -1
- package/Widgets/Core/StateBuilder/manipulatorMixin.js +15 -15
- package/Widgets/Core/WidgetManager.js +11 -2
- package/Widgets/Manipulators/AbstractManipulator.d.ts +221 -0
- package/Widgets/Manipulators/AbstractManipulator.js +57 -0
- package/Widgets/Manipulators/LineManipulator.d.ts +8 -74
- package/Widgets/Manipulators/LineManipulator.js +13 -10
- package/Widgets/Manipulators/PlaneManipulator.d.ts +8 -74
- package/Widgets/Manipulators/PlaneManipulator.js +12 -9
- package/Widgets/Manipulators/TrackballManipulator.d.ts +8 -44
- package/Widgets/Manipulators/TrackballManipulator.js +14 -11
- package/Widgets/Representations/ArrowHandleRepresentation.js +12 -3
- package/Widgets/Representations/CircleContextRepresentation.js +12 -3
- package/Widgets/Representations/CubeHandleRepresentation.js +13 -4
- package/Widgets/Representations/SphereContextRepresentation.js +12 -3
- package/Widgets/Representations/SphereHandleRepresentation.js +12 -3
- package/Widgets/Widgets3D/AngleWidget/behavior.js +7 -4
- package/Widgets/Widgets3D/AngleWidget/state.js +2 -2
- package/Widgets/Widgets3D/AngleWidget.js +19 -2
- package/Widgets/Widgets3D/DistanceWidget/behavior.js +7 -2
- package/Widgets/Widgets3D/DistanceWidget/state.js +2 -2
- package/Widgets/Widgets3D/DistanceWidget.js +19 -2
- package/Widgets/Widgets3D/EllipseWidget.js +4 -3
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +3 -4
- package/Widgets/Widgets3D/ImageCroppingWidget.js +42 -13
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +5 -5
- package/Widgets/Widgets3D/LabelWidget/behavior.js +6 -2
- package/Widgets/Widgets3D/LabelWidget/state.js +2 -2
- package/Widgets/Widgets3D/LabelWidget.js +18 -3
- package/Widgets/Widgets3D/LineWidget/behavior.js +10 -3
- package/Widgets/Widgets3D/LineWidget/state.js +1 -1
- package/Widgets/Widgets3D/LineWidget.js +18 -1
- package/Widgets/Widgets3D/PaintWidget/behavior.js +12 -9
- package/Widgets/Widgets3D/PaintWidget.js +24 -8
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +11 -4
- package/Widgets/Widgets3D/PolyLineWidget/state.js +2 -2
- package/Widgets/Widgets3D/PolyLineWidget.js +21 -2
- package/Widgets/Widgets3D/RectangleWidget.js +6 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +4 -4
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -5
- package/Widgets/Widgets3D/ShapeWidget.js +12 -2
- package/Widgets/Widgets3D/SphereWidget/behavior.js +4 -3
- package/Widgets/Widgets3D/SphereWidget.js +23 -2
- package/Widgets/Widgets3D/SplineWidget/behavior.js +7 -3
- package/Widgets/Widgets3D/SplineWidget/state.js +2 -2
- package/Widgets/Widgets3D/SplineWidget.js +21 -2
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -241,8 +241,9 @@ function widgetBehavior(publicAPI, model) {
|
|
|
241
241
|
var _model$_apiSpecificRe, _model$_apiSpecificRe2, _model$_apiSpecificRe5;
|
|
242
242
|
|
|
243
243
|
var worldMargin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
244
|
-
var viewPlaneOrigin =
|
|
245
|
-
|
|
244
|
+
var viewPlaneOrigin = vtkBoundingBox.getCenter(worldBounds);
|
|
245
|
+
|
|
246
|
+
var viewPlaneNormal = model._renderer.getActiveCamera().getDirectionOfProjection();
|
|
246
247
|
|
|
247
248
|
var viewUp = model._renderer.getActiveCamera().getViewUp();
|
|
248
249
|
|
|
@@ -345,7 +346,11 @@ function widgetBehavior(publicAPI, model) {
|
|
|
345
346
|
|
|
346
347
|
|
|
347
348
|
publicAPI.handleMouseMove = function (callData) {
|
|
348
|
-
|
|
349
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
350
|
+
|
|
351
|
+
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;
|
|
352
|
+
|
|
353
|
+
if (!manipulator || !model.activeState || !model.activeState.getActive() || !model.pickable || !model.dragable) {
|
|
349
354
|
return macro.VOID;
|
|
350
355
|
}
|
|
351
356
|
|
|
@@ -361,10 +366,9 @@ function widgetBehavior(publicAPI, model) {
|
|
|
361
366
|
model.shapeHandle.setUp(up);
|
|
362
367
|
model.shapeHandle.setRight(right);
|
|
363
368
|
model.shapeHandle.setDirection(normal);
|
|
364
|
-
model.manipulator.setNormal(normal);
|
|
365
369
|
}
|
|
366
370
|
|
|
367
|
-
var worldCoords =
|
|
371
|
+
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
368
372
|
|
|
369
373
|
if (!worldCoords.length) {
|
|
370
374
|
return macro.VOID;
|
|
@@ -9,14 +9,24 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
9
|
|
|
10
10
|
function vtkShapeWidget(publicAPI, model) {
|
|
11
11
|
model.classHierarchy.push('vtkShapeWidget');
|
|
12
|
+
|
|
13
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
14
|
+
|
|
12
15
|
model.methodsToLink = ['scaleInPixels', 'textProps', 'fontProperties'];
|
|
16
|
+
|
|
17
|
+
publicAPI.setManipulator = function (manipulator) {
|
|
18
|
+
superClass.setManipulator(manipulator);
|
|
19
|
+
model.widgetState.getStatesWithLabel('moveHandle').forEach(function (handle) {
|
|
20
|
+
return handle.setManipulator(manipulator);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
13
23
|
}
|
|
14
24
|
|
|
15
25
|
function defaultValues(initialValues) {
|
|
16
26
|
var _None;
|
|
17
27
|
|
|
18
28
|
return _objectSpread({
|
|
19
|
-
manipulator: null,
|
|
29
|
+
// manipulator: null,
|
|
20
30
|
modifierBehavior: {
|
|
21
31
|
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)
|
|
22
32
|
},
|
|
@@ -29,7 +39,7 @@ function extend(publicAPI, model) {
|
|
|
29
39
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
40
|
Object.assign(model, defaultValues(initialValues));
|
|
31
41
|
vtkAbstractWidgetFactory.extend(publicAPI, model, initialValues);
|
|
32
|
-
macro.setGet(publicAPI, model, ['modifierBehavior', 'resetAfterPointPlacement']);
|
|
42
|
+
macro.setGet(publicAPI, model, ['manipulator', 'modifierBehavior', 'resetAfterPointPlacement']);
|
|
33
43
|
vtkShapeWidget(publicAPI, model);
|
|
34
44
|
} // ----------------------------------------------------------------------------
|
|
35
45
|
|
|
@@ -12,8 +12,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
12
12
|
model.isDragging = false; // The last world coordinate of the mouse cursor during dragging.
|
|
13
13
|
|
|
14
14
|
model.previousPosition = null;
|
|
15
|
-
centerHandle.setManipulator(model.manipulator);
|
|
16
|
-
borderHandle.setManipulator(model.manipulator);
|
|
17
15
|
model.classHierarchy.push('vtkSphereWidgetProp');
|
|
18
16
|
moveHandle.setVisible(true);
|
|
19
17
|
centerHandle.setVisible(false);
|
|
@@ -55,7 +53,10 @@ function widgetBehavior(publicAPI, model) {
|
|
|
55
53
|
}
|
|
56
54
|
|
|
57
55
|
function currentWorldCoords(e) {
|
|
58
|
-
|
|
56
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
57
|
+
|
|
58
|
+
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;
|
|
59
|
+
return manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
59
60
|
} // Update the sphere's center and radius. Example:
|
|
60
61
|
// handle.setCenterAndRadius([1,2,3], 10);
|
|
61
62
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
1
2
|
import { f as distance2BetweenPoints } from '../../Common/Core/Math/index.js';
|
|
2
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
3
4
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
@@ -7,8 +8,15 @@ import macro from '../../macros.js';
|
|
|
7
8
|
import widgetBehavior from './SphereWidget/behavior.js';
|
|
8
9
|
import stateGenerator from './SphereWidget/state.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; }
|
|
14
|
+
|
|
10
15
|
function vtkSphereWidget(publicAPI, model) {
|
|
11
16
|
model.classHierarchy.push('vtkSphereWidget');
|
|
17
|
+
|
|
18
|
+
var superClass = _objectSpread({}, publicAPI);
|
|
19
|
+
|
|
12
20
|
model.behavior = widgetBehavior;
|
|
13
21
|
|
|
14
22
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
@@ -34,7 +42,8 @@ function vtkSphereWidget(publicAPI, model) {
|
|
|
34
42
|
builder: vtkSphereContextRepresentation,
|
|
35
43
|
labels: ['sphereHandle']
|
|
36
44
|
}];
|
|
37
|
-
};
|
|
45
|
+
}; // --- Public methods -------------------------------------------------------
|
|
46
|
+
|
|
38
47
|
|
|
39
48
|
publicAPI.getRadius = function () {
|
|
40
49
|
var h1 = model.widgetState.getCenterHandle();
|
|
@@ -42,8 +51,20 @@ function vtkSphereWidget(publicAPI, model) {
|
|
|
42
51
|
return Math.sqrt(distance2BetweenPoints(h1.getOrigin(), h2.getOrigin()));
|
|
43
52
|
};
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
publicAPI.setManipulator = function (manipulator) {
|
|
55
|
+
superClass.setManipulator(manipulator);
|
|
56
|
+
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
57
|
+
model.widgetState.getCenterHandle().setManipulator(manipulator);
|
|
58
|
+
model.widgetState.getBorderHandle().setManipulator(manipulator);
|
|
59
|
+
}; // --------------------------------------------------------------------------
|
|
60
|
+
// initialization
|
|
61
|
+
// --------------------------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
|
|
46
64
|
model.widgetState = stateGenerator();
|
|
65
|
+
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
66
|
+
useCameraNormal: true
|
|
67
|
+
}));
|
|
47
68
|
}
|
|
48
69
|
|
|
49
70
|
function extend(publicAPI, model) {
|
|
@@ -32,6 +32,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
32
32
|
|
|
33
33
|
model.lastHandle.setColor(model.moveHandle.getColor());
|
|
34
34
|
model.lastHandle.setScale1(model.moveHandle.getScale1());
|
|
35
|
+
model.lastHandle.setManipulator(model.manipulator);
|
|
35
36
|
|
|
36
37
|
if (!model.firstHandle) {
|
|
37
38
|
model.firstHandle = model.lastHandle;
|
|
@@ -247,12 +248,15 @@ function widgetBehavior(publicAPI, model) {
|
|
|
247
248
|
|
|
248
249
|
|
|
249
250
|
publicAPI.handleMouseMove = function (callData) {
|
|
250
|
-
|
|
251
|
+
var _model$activeState$ge, _model$activeState, _model$activeState$ge2;
|
|
252
|
+
|
|
253
|
+
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;
|
|
254
|
+
|
|
255
|
+
if (!manipulator || !model.activeState || !model.activeState.getActive() || !model.pickable) {
|
|
251
256
|
return macro.VOID;
|
|
252
257
|
}
|
|
253
258
|
|
|
254
|
-
|
|
255
|
-
var worldCoords = model.manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
259
|
+
var worldCoords = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
256
260
|
var hoveredHandle = getHoveredHandle();
|
|
257
261
|
|
|
258
262
|
if (hoveredHandle) {
|
|
@@ -16,7 +16,7 @@ function generateState() {
|
|
|
16
16
|
initialValue: 0
|
|
17
17
|
}).addStateFromMixin({
|
|
18
18
|
labels: ['moveHandle'],
|
|
19
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
19
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
20
20
|
name: 'moveHandle',
|
|
21
21
|
initialValues: {
|
|
22
22
|
scale1: 0.05,
|
|
@@ -24,7 +24,7 @@ function generateState() {
|
|
|
24
24
|
}
|
|
25
25
|
}).addDynamicMixinState({
|
|
26
26
|
labels: ['handles'],
|
|
27
|
-
mixins: ['origin', 'color', 'scale1', 'visible'],
|
|
27
|
+
mixins: ['origin', 'color', 'scale1', 'visible', 'manipulator'],
|
|
28
28
|
name: 'handle',
|
|
29
29
|
initialValues: {
|
|
30
30
|
scale1: 0.05
|
|
@@ -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 vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
@@ -7,11 +8,17 @@ import widgetBehavior from './SplineWidget/behavior.js';
|
|
|
7
8
|
import generateState from './SplineWidget/state.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
|
// Factory
|
|
11
15
|
// ----------------------------------------------------------------------------
|
|
12
16
|
|
|
13
17
|
function vtkSplineWidget(publicAPI, model) {
|
|
14
|
-
model.classHierarchy.push('vtkSplineWidget');
|
|
18
|
+
model.classHierarchy.push('vtkSplineWidget');
|
|
19
|
+
|
|
20
|
+
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
21
|
+
|
|
15
22
|
|
|
16
23
|
model.methodsToLink = ['outputBorder', 'fill', 'borderColor', 'errorBorderColor'];
|
|
17
24
|
model.behavior = widgetBehavior;
|
|
@@ -35,17 +42,29 @@ function vtkSplineWidget(publicAPI, model) {
|
|
|
35
42
|
labels: ['handles', 'moveHandle']
|
|
36
43
|
}];
|
|
37
44
|
}
|
|
45
|
+
}; // --- Public methods -------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
publicAPI.setManipulator = function (manipulator) {
|
|
49
|
+
superClass.setManipulator(manipulator);
|
|
50
|
+
model.widgetState.getMoveHandle().setManipulator(manipulator);
|
|
51
|
+
model.widgetState.getHandleList().forEach(function (handle) {
|
|
52
|
+
handle.setManipulator(manipulator);
|
|
53
|
+
});
|
|
38
54
|
}; // --------------------------------------------------------------------------
|
|
39
55
|
// initialization
|
|
40
56
|
// --------------------------------------------------------------------------
|
|
41
57
|
// Default manipulator
|
|
42
58
|
|
|
43
59
|
|
|
44
|
-
model.manipulator
|
|
60
|
+
publicAPI.setManipulator(model.manipulator || model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
61
|
+
useCameraNormal: true
|
|
62
|
+
}));
|
|
45
63
|
} // ----------------------------------------------------------------------------
|
|
46
64
|
|
|
47
65
|
|
|
48
66
|
var DEFAULT_VALUES = {
|
|
67
|
+
// manipulator: null,
|
|
49
68
|
freehandMinDistance: 0.1,
|
|
50
69
|
allowFreehand: true,
|
|
51
70
|
resolution: 32,
|
package/index.d.ts
CHANGED
|
@@ -138,6 +138,7 @@
|
|
|
138
138
|
/// <reference path="./Rendering/SceneGraph/RenderPass.d.ts" />
|
|
139
139
|
/// <reference path="./Rendering/SceneGraph/ViewNode.d.ts" />
|
|
140
140
|
/// <reference path="./Rendering/SceneGraph/ViewNodeFactory.d.ts" />
|
|
141
|
+
/// <reference path="./Widgets/Manipulators/AbstractManipulator.d.ts" />
|
|
141
142
|
/// <reference path="./Widgets/Manipulators/LineManipulator.d.ts" />
|
|
142
143
|
/// <reference path="./Widgets/Manipulators/PlaneManipulator.d.ts" />
|
|
143
144
|
/// <reference path="./Widgets/Manipulators/TrackballManipulator.d.ts" />
|