@kitware/vtk.js 25.10.0 → 26.0.0-beta.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.
- package/Common/Core/CellArray.d.ts +0 -6
- package/Common/Core/CellArray.js +21 -12
- package/Common/Core/ClassHierarchy.js +11 -6
- package/Common/Core/DataArray.d.ts +20 -0
- package/Common/Core/DataArray.js +21 -4
- package/Proxy/Core/ViewProxy.js +17 -9
- package/Rendering/Core/ColorTransferFunction.d.ts +0 -20
- package/Rendering/Core/ColorTransferFunction.js +0 -63
- package/Rendering/Core/Prop3D.js +1 -6
- package/Rendering/Core/RenderWindow.js +9 -6
- package/Rendering/Core/VolumeProperty.js +2 -3
- package/Rendering/Misc/CanvasView.js +6 -5
- package/Rendering/Misc/GenericRenderWindow.js +12 -7
- package/Rendering/OpenGL/Actor.js +4 -4
- package/Rendering/OpenGL/Actor2D.js +4 -4
- package/Rendering/OpenGL/Camera.js +7 -4
- package/Rendering/OpenGL/CubeAxesActor.js +7 -5
- package/Rendering/OpenGL/ForwardPass.js +1 -1
- package/Rendering/OpenGL/Glyph3DMapper.js +4 -4
- package/Rendering/OpenGL/ImageMapper.js +9 -5
- package/Rendering/OpenGL/ImageSlice.js +3 -3
- package/Rendering/OpenGL/PixelSpaceCallbackMapper.js +9 -5
- package/Rendering/OpenGL/PolyDataMapper.js +27 -21
- package/Rendering/OpenGL/PolyDataMapper2D.js +17 -10
- package/Rendering/OpenGL/ScalarBarActor.js +6 -4
- package/Rendering/OpenGL/Skybox.js +10 -6
- package/Rendering/OpenGL/Texture.js +6 -5
- package/Rendering/OpenGL/Volume.js +2 -2
- package/Rendering/OpenGL/VolumeMapper.js +11 -11
- package/Rendering/OpenGL/glsl/vtkVolumeFS.glsl.js +1 -1
- package/Rendering/SceneGraph/RenderPass.js +3 -2
- package/Rendering/WebGPU/ForwardPass.js +1 -1
- package/Rendering/WebGPU/HardwareSelectionPass.js +1 -1
- package/Rendering/WebGPU/HardwareSelector.js +14 -13
- package/Rendering/WebGPU/OpaquePass.js +1 -1
- package/Rendering/WebGPU/OrderIndependentTranslucentPass.js +1 -1
- package/Rendering/WebGPU/VolumePass.js +1 -1
- package/Utilities/config/rules-tests.js +28 -0
- package/Widgets/Core/AbstractWidgetFactory.js +1 -0
- package/Widgets/Core/StateBuilder/color3Mixin.js +22 -0
- package/Widgets/Core/StateBuilder/colorMixin.js +7 -0
- package/Widgets/Core/StateBuilder.js +2 -0
- package/Widgets/Core/WidgetManager.js +21 -256
- package/Widgets/Representations/ArrowHandleRepresentation.js +28 -110
- package/Widgets/Representations/CircleContextRepresentation.js +43 -165
- package/Widgets/Representations/ContextRepresentation.js +0 -3
- package/Widgets/Representations/ConvexFaceContextRepresentation.js +11 -11
- package/Widgets/Representations/CroppingOutlineRepresentation.js +5 -12
- package/Widgets/Representations/CubeHandleRepresentation.js +15 -104
- package/Widgets/Representations/GlyphRepresentation.js +320 -0
- package/Widgets/Representations/HandleRepresentation.js +0 -5
- package/Widgets/Representations/ImplicitPlaneRepresentation.js +68 -49
- package/Widgets/Representations/LineHandleRepresentation.js +116 -0
- package/Widgets/Representations/PolyLineRepresentation.js +52 -49
- package/Widgets/Representations/RectangleContextRepresentation.js +16 -21
- package/Widgets/Representations/SphereContextRepresentation.js +30 -109
- package/Widgets/Representations/SphereHandleRepresentation.js +13 -110
- package/Widgets/Representations/SplineContextRepresentation.js +53 -36
- package/Widgets/Representations/WidgetRepresentation.d.ts +52 -1
- package/Widgets/Representations/WidgetRepresentation.js +140 -78
- package/Widgets/Representations.js +6 -0
- package/Widgets/Widgets3D/AngleWidget.js +1 -4
- package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
- package/Widgets/Widgets3D/EllipseWidget.js +0 -7
- package/Widgets/Widgets3D/LabelWidget/behavior.js +0 -7
- package/Widgets/Widgets3D/LabelWidget.js +1 -18
- package/Widgets/Widgets3D/LineWidget/behavior.js +0 -44
- package/Widgets/Widgets3D/LineWidget.js +0 -11
- package/Widgets/Widgets3D/PolyLineWidget.js +0 -10
- package/Widgets/Widgets3D/RectangleWidget.js +0 -7
- package/Widgets/Widgets3D/ResliceCursorWidget/Constants.js +15 -3
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.js +93 -36
- package/Widgets/Widgets3D/ResliceCursorWidget/helpers.js +75 -82
- package/Widgets/Widgets3D/ResliceCursorWidget/state.js +49 -170
- package/Widgets/Widgets3D/ResliceCursorWidget.js +61 -23
- package/Widgets/Widgets3D/ShapeWidget.js +1 -1
- package/index.d.ts +0 -1
- package/macros.d.ts +3 -5
- package/macros.js +4 -35
- package/package.json +3 -2
- package/Widgets/Core/WidgetManager/vdom.js +0 -172
- package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
- package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
- package/Widgets/SVG/SVGLandmarkRepresentation/Constants.js +0 -28
- package/Widgets/SVG/SVGLandmarkRepresentation.js +0 -179
- package/Widgets/SVG/SVGRepresentation.js +0 -163
- package/_vendor/available-typed-arrays/index.js_commonjs-proxy.js +0 -1
- package/_vendor/call-bind/callBound.js_commonjs-proxy.js +0 -1
- package/_vendor/call-bind/index.js_commonjs-module.js +0 -3
- package/_vendor/call-bind/index.js_commonjs-proxy.js +0 -1
- package/_vendor/deep-equal/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
- package/_vendor/define-properties/index.js_commonjs-proxy.js +0 -1
- package/_vendor/es-abstract/helpers/getOwnPropertyDescriptor.js_commonjs-proxy.js +0 -1
- package/_vendor/es-get-iterator/index.js_commonjs-module.js +0 -3
- package/_vendor/es-get-iterator/index.js_commonjs-proxy.js +0 -1
- package/_vendor/es-get-iterator/node_modules/isarray/index.js_commonjs-proxy.js +0 -1
- package/_vendor/foreach/index.js_commonjs-proxy.js +0 -1
- package/_vendor/function-bind/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/function-bind/index.js_commonjs-proxy.js +0 -1
- package/_vendor/get-intrinsic/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has/src/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-bigints/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-symbols/index.js_commonjs-proxy.js +0 -1
- package/_vendor/has-symbols/shams.js_commonjs-proxy.js +0 -1
- package/_vendor/has-tostringtag/shams.js_commonjs-proxy.js +0 -1
- package/_vendor/is-arguments/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-bigint/index.js_commonjs-module.js +0 -3
- package/_vendor/is-bigint/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-boolean-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-date-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-map/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-number-object/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-regex/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-set/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-string/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-symbol/index.js_commonjs-module.js +0 -3
- package/_vendor/is-symbol/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-typed-array/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-weakmap/index.js_commonjs-proxy.js +0 -1
- package/_vendor/is-weakset/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-inspect/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/object-is/shim.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object-keys/isArguments.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/index.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/object.assign/shim.js_commonjs-proxy.js +0 -2
- package/_vendor/regexp.prototype.flags/implementation.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/index.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/polyfill.js_commonjs-proxy.js +0 -1
- package/_vendor/regexp.prototype.flags/shim.js_commonjs-proxy.js +0 -1
- package/_vendor/side-channel/index.js_commonjs-proxy.js +0 -1
- package/_vendor/which-boxed-primitive/index.js_commonjs-proxy.js +0 -5
- package/_vendor/which-collection/index.js_commonjs-proxy.js +0 -4
- package/_vendor/which-typed-array/index.js_commonjs-proxy.js +0 -1
- package/_virtual/_node-resolve_empty.js_commonjs-proxy.js +0 -6
- package/_virtual/commonjsHelpers.js +0 -18
- package/_virtual/node-resolve_empty.js +0 -8
- package/_virtual/polyfill-node.global.js +0 -5
- package/_virtual/polyfill-node.process.js +0 -225
- package/vendor/available-typed-arrays/index.js +0 -29
- package/vendor/call-bind/callBound.js +0 -19
- package/vendor/call-bind/index.js +0 -52
- package/vendor/deep-equal/index.js +0 -379
- package/vendor/deep-equal/node_modules/isarray/index.js +0 -7
- package/vendor/define-properties/index.js +0 -60
- package/vendor/es-abstract/helpers/getOwnPropertyDescriptor.js +0 -17
- package/vendor/es-get-iterator/index.js +0 -217
- package/vendor/es-get-iterator/node_modules/isarray/index.js +0 -7
- package/vendor/foreach/index.js +0 -22
- package/vendor/function-bind/implementation.js +0 -52
- package/vendor/function-bind/index.js +0 -7
- package/vendor/get-intrinsic/index.js +0 -334
- package/vendor/has/src/index.js +0 -7
- package/vendor/has-bigints/index.js +0 -12
- package/vendor/has-symbols/index.js +0 -15
- package/vendor/has-symbols/shams.js +0 -42
- package/vendor/has-tostringtag/shams.js +0 -9
- package/vendor/is-arguments/index.js +0 -36
- package/vendor/is-bigint/index.js +0 -39
- package/vendor/is-boolean-object/index.js +0 -29
- package/vendor/is-date-object/index.js +0 -22
- package/vendor/is-map/index.js +0 -42
- package/vendor/is-number-object/index.js +0 -26
- package/vendor/is-regex/index.js +0 -61
- package/vendor/is-set/index.js +0 -42
- package/vendor/is-string/index.js +0 -26
- package/vendor/is-symbol/index.js +0 -36
- package/vendor/is-typed-array/index.js +0 -67
- package/vendor/is-weakmap/index.js +0 -42
- package/vendor/is-weakset/index.js +0 -42
- package/vendor/object-inspect/index.js +0 -515
- package/vendor/object-is/implementation.js +0 -18
- package/vendor/object-is/index.js +0 -25
- package/vendor/object-is/polyfill.js +0 -9
- package/vendor/object-is/shim.js +0 -17
- package/vendor/object-keys/implementation.js +0 -124
- package/vendor/object-keys/index.js +0 -35
- package/vendor/object-keys/isArguments.js +0 -17
- package/vendor/object.assign/implementation.js +0 -46
- package/vendor/object.assign/index.js +0 -29
- package/vendor/object.assign/polyfill.js +0 -57
- package/vendor/object.assign/shim.js +0 -17
- package/vendor/regexp.prototype.flags/implementation.js +0 -30
- package/vendor/regexp.prototype.flags/index.js +0 -25
- package/vendor/regexp.prototype.flags/polyfill.js +0 -23
- package/vendor/regexp.prototype.flags/shim.js +0 -29
- package/vendor/side-channel/index.js +0 -128
- package/vendor/which-boxed-primitive/index.js +0 -38
- package/vendor/which-collection/index.js +0 -29
- package/vendor/which-typed-array/index.js +0 -63
|
@@ -2,11 +2,14 @@ import vtkCircleContextRepresentation from './Representations/CircleContextRepre
|
|
|
2
2
|
import vtkContextRepresentation from './Representations/ContextRepresentation.js';
|
|
3
3
|
import vtkConvexFaceContextRepresentation from './Representations/ConvexFaceContextRepresentation.js';
|
|
4
4
|
import vtkCubeHandleRepresentation from './Representations/CubeHandleRepresentation.js';
|
|
5
|
+
import vtkGlyphRepresentation from './Representations/GlyphRepresentation.js';
|
|
5
6
|
import vtkHandleRepresentation from './Representations/HandleRepresentation.js';
|
|
6
7
|
import vtkImplicitPlaneRepresentation from './Representations/ImplicitPlaneRepresentation.js';
|
|
8
|
+
import vtkLineHandleRepresentation from './Representations/LineHandleRepresentation.js';
|
|
7
9
|
import vtkOutlineContextRepresentation from './Representations/OutlineContextRepresentation.js';
|
|
8
10
|
import vtkPolyLineRepresentation from './Representations/PolyLineRepresentation.js';
|
|
9
11
|
import vtkSphereHandleRepresentation from './Representations/SphereHandleRepresentation.js';
|
|
12
|
+
import vtkSplineContextRepresentation from './Representations/SplineContextRepresentation.js';
|
|
10
13
|
import vtkWidgetRepresentation from './Representations/WidgetRepresentation.js';
|
|
11
14
|
|
|
12
15
|
var Representations = {
|
|
@@ -14,11 +17,14 @@ var Representations = {
|
|
|
14
17
|
vtkContextRepresentation: vtkContextRepresentation,
|
|
15
18
|
vtkConvexFaceContextRepresentation: vtkConvexFaceContextRepresentation,
|
|
16
19
|
vtkCubeHandleRepresentation: vtkCubeHandleRepresentation,
|
|
20
|
+
vtkGlyphRepresentation: vtkGlyphRepresentation,
|
|
17
21
|
vtkHandleRepresentation: vtkHandleRepresentation,
|
|
18
22
|
vtkImplicitPlaneRepresentation: vtkImplicitPlaneRepresentation,
|
|
23
|
+
vtkLineHandleRepresentation: vtkLineHandleRepresentation,
|
|
19
24
|
vtkOutlineContextRepresentation: vtkOutlineContextRepresentation,
|
|
20
25
|
vtkPolyLineRepresentation: vtkPolyLineRepresentation,
|
|
21
26
|
vtkSphereHandleRepresentation: vtkSphereHandleRepresentation,
|
|
27
|
+
vtkSplineContextRepresentation: vtkSplineContextRepresentation,
|
|
22
28
|
vtkWidgetRepresentation: vtkWidgetRepresentation
|
|
23
29
|
};
|
|
24
30
|
|
|
@@ -32,10 +32,7 @@ function vtkAngleWidget(publicAPI, model) {
|
|
|
32
32
|
default:
|
|
33
33
|
return [{
|
|
34
34
|
builder: vtkSphereHandleRepresentation,
|
|
35
|
-
labels: ['handles']
|
|
36
|
-
}, {
|
|
37
|
-
builder: vtkSphereHandleRepresentation,
|
|
38
|
-
labels: ['moveHandle']
|
|
35
|
+
labels: ['handles', 'moveHandle']
|
|
39
36
|
}, {
|
|
40
37
|
builder: vtkPolyLineRepresentation,
|
|
41
38
|
labels: ['handles', 'moveHandle']
|
|
@@ -23,7 +23,7 @@ function generateState() {
|
|
|
23
23
|
mixins: ['origin', 'color', 'scale3', 'visible', 'orientation'],
|
|
24
24
|
name: 'ellipseHandle',
|
|
25
25
|
initialValues: {
|
|
26
|
-
visible: false,
|
|
26
|
+
// visible: false,
|
|
27
27
|
scale3: [1, 1, 1]
|
|
28
28
|
}
|
|
29
29
|
}) // FIXME: How to not duplicate with RectangleWidget
|
|
@@ -5,7 +5,6 @@ import vtkCircleContextRepresentation from '../Representations/CircleContextRepr
|
|
|
5
5
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
6
6
|
import vtkShapeWidget from './ShapeWidget.js';
|
|
7
7
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
8
|
-
import vtkSVGLandmarkRepresentation from '../SVG/SVGLandmarkRepresentation.js';
|
|
9
8
|
import widgetBehavior from './EllipseWidget/behavior.js';
|
|
10
9
|
import generateState from './EllipseWidget/state.js';
|
|
11
10
|
import { BehaviorCategory, ShapeBehavior } from './ShapeWidget/Constants.js';
|
|
@@ -35,12 +34,6 @@ function vtkEllipseWidget(publicAPI, model) {
|
|
|
35
34
|
}, {
|
|
36
35
|
builder: vtkCircleContextRepresentation,
|
|
37
36
|
labels: ['ellipseHandle']
|
|
38
|
-
}, {
|
|
39
|
-
builder: vtkSVGLandmarkRepresentation,
|
|
40
|
-
initialValues: {
|
|
41
|
-
text: ''
|
|
42
|
-
},
|
|
43
|
-
labels: ['SVGtext']
|
|
44
37
|
}];
|
|
45
38
|
}
|
|
46
39
|
}; // --------------------------------------------------------------------------
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
1
|
import macro from '../../../macros.js';
|
|
3
2
|
|
|
4
|
-
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; }
|
|
5
|
-
|
|
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
3
|
function widgetBehavior(publicAPI, model) {
|
|
8
4
|
model.classHierarchy.push('vtkLabelWidgetProp');
|
|
9
5
|
model._isDragging = false; // --------------------------------------------------------------------------
|
|
@@ -12,9 +8,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
12
8
|
|
|
13
9
|
publicAPI.setText = function (text) {
|
|
14
10
|
model.widgetState.getText().setText(text);
|
|
15
|
-
model.representations[1].setCircleProps(_objectSpread(_objectSpread({}, model.representations[1].getCircleProps()), {}, {
|
|
16
|
-
visible: !text
|
|
17
|
-
}));
|
|
18
11
|
|
|
19
12
|
model._interactor.render();
|
|
20
13
|
};
|
|
@@ -2,11 +2,9 @@ import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
|
2
2
|
import macro from '../../macros.js';
|
|
3
3
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
4
4
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
5
|
-
import vtkSVGLandmarkRepresentation from '../SVG/SVGLandmarkRepresentation.js';
|
|
6
5
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
7
6
|
import widgetBehavior from './LabelWidget/behavior.js';
|
|
8
7
|
import generateState from './LabelWidget/state.js';
|
|
9
|
-
import { VerticalTextAlignment } from '../SVG/SVGLandmarkRepresentation/Constants.js';
|
|
10
8
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
11
9
|
|
|
12
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; }
|
|
@@ -21,7 +19,7 @@ function vtkLabelWidget(publicAPI, model) {
|
|
|
21
19
|
var superClass = _objectSpread({}, publicAPI); // --- Widget Requirement ---------------------------------------------------
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
model.methodsToLink = ['
|
|
22
|
+
model.methodsToLink = ['scaleInPixels'];
|
|
25
23
|
|
|
26
24
|
publicAPI.getRepresentationsForViewType = function (viewType) {
|
|
27
25
|
switch (viewType) {
|
|
@@ -33,21 +31,6 @@ function vtkLabelWidget(publicAPI, model) {
|
|
|
33
31
|
return [{
|
|
34
32
|
builder: vtkSphereHandleRepresentation,
|
|
35
33
|
labels: ['moveHandle']
|
|
36
|
-
}, {
|
|
37
|
-
builder: vtkSVGLandmarkRepresentation,
|
|
38
|
-
initialValues: {
|
|
39
|
-
circleProps: {
|
|
40
|
-
visible: true
|
|
41
|
-
},
|
|
42
|
-
textProps: {
|
|
43
|
-
'text-anchor': 'middle',
|
|
44
|
-
verticalAlign: VerticalTextAlignment.MIDDLE
|
|
45
|
-
},
|
|
46
|
-
strokeFontProperties: {
|
|
47
|
-
fontStyle: 'bold'
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
labels: ['SVGtext']
|
|
51
34
|
}];
|
|
52
35
|
}
|
|
53
36
|
}; // --- Public methods -------------------------------------------------------
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
1
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
2
|
import Constants from './Constants.js';
|
|
4
3
|
import macro from '../../../macros.js';
|
|
5
4
|
import { s as subtract, l as add, m as normalize } from '../../../Common/Core/Math/index.js';
|
|
6
5
|
import { getNumberOfPlacedHandles, isHandlePlaced, calculateTextPosition, updateTextPosition, getPoint } from './helpers.js';
|
|
7
6
|
|
|
8
|
-
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; }
|
|
9
|
-
|
|
10
|
-
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; }
|
|
11
7
|
var ShapeType = Constants.ShapeType; // Total number of points to place
|
|
12
8
|
|
|
13
9
|
var MAX_POINTS = 2;
|
|
@@ -70,44 +66,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
70
66
|
// Text methods
|
|
71
67
|
// --------------------------------------------------------------------------
|
|
72
68
|
|
|
73
|
-
/**
|
|
74
|
-
* check for handle 2 position in comparison to handle 1 position
|
|
75
|
-
* and sets text offset to not overlap on the line representation
|
|
76
|
-
*/
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function getOffsetDirectionForTextPosition() {
|
|
80
|
-
var pos1 = publicAPI.getHandle(0).getOrigin();
|
|
81
|
-
var pos2 = publicAPI.getHandle(1).getOrigin();
|
|
82
|
-
var dySign = 1;
|
|
83
|
-
|
|
84
|
-
if (pos1 && pos2) {
|
|
85
|
-
if (pos1[0] <= pos2[0]) {
|
|
86
|
-
dySign = pos1[1] <= pos2[1] ? 1 : -1;
|
|
87
|
-
} else {
|
|
88
|
-
dySign = pos1[1] <= pos2[1] ? -1 : 1;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return dySign;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* place SVGText on line according to both handle positions
|
|
96
|
-
* which purpose is to never have text representation overlapping
|
|
97
|
-
* on PolyLine representation
|
|
98
|
-
* */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
publicAPI.placeText = function () {
|
|
102
|
-
var dySign = getOffsetDirectionForTextPosition();
|
|
103
|
-
|
|
104
|
-
var textPropsCp = _objectSpread({}, model.representations[3].getTextProps());
|
|
105
|
-
|
|
106
|
-
textPropsCp.dy = dySign * Math.abs(textPropsCp.dy);
|
|
107
|
-
model.representations[3].setTextProps(textPropsCp);
|
|
108
|
-
|
|
109
|
-
model._interactor.render();
|
|
110
|
-
};
|
|
111
69
|
|
|
112
70
|
publicAPI.setText = function (text) {
|
|
113
71
|
model.widgetState.getText().setText(text);
|
|
@@ -211,7 +169,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
211
169
|
}
|
|
212
170
|
|
|
213
171
|
if (handleIndex === 1) {
|
|
214
|
-
publicAPI.placeText();
|
|
215
172
|
publicAPI.loseFocus();
|
|
216
173
|
}
|
|
217
174
|
}; // --------------------------------------------------------------------------
|
|
@@ -289,7 +246,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
289
246
|
if (model._isDragging && publicAPI.isPlaced()) {
|
|
290
247
|
var wasTextActive = model.widgetState.getText().getActive(); // Recompute offsets
|
|
291
248
|
|
|
292
|
-
publicAPI.placeText();
|
|
293
249
|
model.widgetState.deactivate();
|
|
294
250
|
model.activeState = null;
|
|
295
251
|
|
|
@@ -5,7 +5,6 @@ import generateState from './LineWidget/state.js';
|
|
|
5
5
|
import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
6
6
|
import vtkArrowHandleRepresentation from '../Representations/ArrowHandleRepresentation.js';
|
|
7
7
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
8
|
-
import vtkSVGLandmarkRepresentation from '../SVG/SVGLandmarkRepresentation.js';
|
|
9
8
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
10
9
|
import widgetBehavior from './LineWidget/behavior.js';
|
|
11
10
|
import { Behavior } from '../Representations/WidgetRepresentation/Constants.js';
|
|
@@ -107,16 +106,6 @@ function vtkLineWidget(publicAPI, model) {
|
|
|
107
106
|
}
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
|
-
}, {
|
|
111
|
-
builder: vtkSVGLandmarkRepresentation,
|
|
112
|
-
initialValues: {
|
|
113
|
-
text: '',
|
|
114
|
-
textProps: {
|
|
115
|
-
dx: 12,
|
|
116
|
-
dy: -12
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
labels: ['SVGtext']
|
|
120
109
|
}, {
|
|
121
110
|
builder: vtkPolyLineRepresentation,
|
|
122
111
|
labels: ['handle1', 'handle2', 'moveHandle'],
|
|
@@ -4,7 +4,6 @@ import vtkAbstractWidgetFactory from '../Core/AbstractWidgetFactory.js';
|
|
|
4
4
|
import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
5
5
|
import vtkPolyLineRepresentation from '../Representations/PolyLineRepresentation.js';
|
|
6
6
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
7
|
-
import vtkSVGLandmarkRepresentation from '../SVG/SVGLandmarkRepresentation.js';
|
|
8
7
|
import widgetBehavior from './PolyLineWidget/behavior.js';
|
|
9
8
|
import generateState from './PolyLineWidget/state.js';
|
|
10
9
|
import { ViewTypes } from '../Core/WidgetManager/Constants.js';
|
|
@@ -36,15 +35,6 @@ function vtkPolyLineWidget(publicAPI, model) {
|
|
|
36
35
|
}, {
|
|
37
36
|
builder: vtkSphereHandleRepresentation,
|
|
38
37
|
labels: ['moveHandle']
|
|
39
|
-
}, {
|
|
40
|
-
builder: vtkSVGLandmarkRepresentation,
|
|
41
|
-
initialValues: {
|
|
42
|
-
textProps: {
|
|
43
|
-
dx: 12,
|
|
44
|
-
dy: -12
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
labels: ['handles']
|
|
48
38
|
}, {
|
|
49
39
|
builder: vtkPolyLineRepresentation,
|
|
50
40
|
labels: ['handles', 'moveHandle']
|
|
@@ -5,7 +5,6 @@ import vtkPlanePointManipulator from '../Manipulators/PlaneManipulator.js';
|
|
|
5
5
|
import vtkShapeWidget from './ShapeWidget.js';
|
|
6
6
|
import vtkSphereHandleRepresentation from '../Representations/SphereHandleRepresentation.js';
|
|
7
7
|
import vtkRectangleContextRepresentation from '../Representations/RectangleContextRepresentation.js';
|
|
8
|
-
import vtkSVGLandmarkRepresentation from '../SVG/SVGLandmarkRepresentation.js';
|
|
9
8
|
import widgetBehavior from './RectangleWidget/behavior.js';
|
|
10
9
|
import generateState from './RectangleWidget/state.js';
|
|
11
10
|
import { BehaviorCategory, ShapeBehavior } from './ShapeWidget/Constants.js';
|
|
@@ -34,12 +33,6 @@ function vtkRectangleWidget(publicAPI, model) {
|
|
|
34
33
|
}, {
|
|
35
34
|
builder: vtkRectangleContextRepresentation,
|
|
36
35
|
labels: ['rectangleHandle']
|
|
37
|
-
}, {
|
|
38
|
-
builder: vtkSVGLandmarkRepresentation,
|
|
39
|
-
initialValues: {
|
|
40
|
-
text: ''
|
|
41
|
-
},
|
|
42
|
-
labels: ['SVGtext']
|
|
43
36
|
}];
|
|
44
37
|
}
|
|
45
38
|
}; // --------------------------------------------------------------------------
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import { ViewTypes } from '../../Core/WidgetManager/Constants.js';
|
|
3
3
|
|
|
4
|
-
var _defaultViewUpFromVie, _viewTypeToXYZ;
|
|
4
|
+
var _defaultViewUpFromVie, _viewTypeToXYZ, _viewTypeToPlaneName;
|
|
5
5
|
var ScrollingMethods = {
|
|
6
6
|
MIDDLE_MOUSE_BUTTON: 0,
|
|
7
7
|
LEFT_MOUSE_BUTTON: 1,
|
|
@@ -17,11 +17,23 @@ var InteractionMethodsName = {
|
|
|
17
17
|
var defaultViewUpFromViewType = (_defaultViewUpFromVie = {}, _defineProperty(_defaultViewUpFromVie, ViewTypes.YZ_PLANE, [0, 0, 1]), _defineProperty(_defaultViewUpFromVie, ViewTypes.XZ_PLANE, [0, 0, 1]), _defineProperty(_defaultViewUpFromVie, ViewTypes.XY_PLANE, [0, -1, 0]), _defaultViewUpFromVie);
|
|
18
18
|
var xyzToViewType = [ViewTypes.YZ_PLANE, ViewTypes.XZ_PLANE, ViewTypes.XY_PLANE];
|
|
19
19
|
var viewTypeToXYZ = (_viewTypeToXYZ = {}, _defineProperty(_viewTypeToXYZ, ViewTypes.YZ_PLANE, 0), _defineProperty(_viewTypeToXYZ, ViewTypes.XZ_PLANE, 1), _defineProperty(_viewTypeToXYZ, ViewTypes.XY_PLANE, 2), _viewTypeToXYZ);
|
|
20
|
+
var planeNames = ['X', 'Y', 'Z'];
|
|
21
|
+
var viewTypeToPlaneName = (_viewTypeToPlaneName = {}, _defineProperty(_viewTypeToPlaneName, ViewTypes.YZ_PLANE, 'X'), _defineProperty(_viewTypeToPlaneName, ViewTypes.XZ_PLANE, 'Y'), _defineProperty(_viewTypeToPlaneName, ViewTypes.XY_PLANE, 'Z'), _viewTypeToPlaneName);
|
|
22
|
+
var planeNameToViewType = {
|
|
23
|
+
X: ViewTypes.YZ_PLANE,
|
|
24
|
+
Y: ViewTypes.XZ_PLANE,
|
|
25
|
+
Z: ViewTypes.XY_PLANE
|
|
26
|
+
};
|
|
27
|
+
var lineNames = ['YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ', 'YinZ'];
|
|
20
28
|
var Constants = {
|
|
21
29
|
ScrollingMethods: ScrollingMethods,
|
|
22
30
|
InteractionMethodsName: InteractionMethodsName,
|
|
23
31
|
xyzToViewType: xyzToViewType,
|
|
24
|
-
viewTypeToXYZ: viewTypeToXYZ
|
|
32
|
+
viewTypeToXYZ: viewTypeToXYZ,
|
|
33
|
+
planeNames: planeNames,
|
|
34
|
+
viewTypeToPlaneName: viewTypeToPlaneName,
|
|
35
|
+
planeNameToViewType: planeNameToViewType,
|
|
36
|
+
lineNames: lineNames
|
|
25
37
|
};
|
|
26
38
|
|
|
27
|
-
export { InteractionMethodsName, ScrollingMethods, Constants as default, defaultViewUpFromViewType, viewTypeToXYZ, xyzToViewType };
|
|
39
|
+
export { InteractionMethodsName, ScrollingMethods, Constants as default, defaultViewUpFromViewType, lineNames, planeNameToViewType, planeNames, viewTypeToPlaneName, viewTypeToXYZ, xyzToViewType };
|
|
@@ -3,16 +3,75 @@ 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 {
|
|
7
|
-
import {
|
|
8
|
-
import { InteractionMethodsName, ScrollingMethods } from './Constants.js';
|
|
6
|
+
import { l as add, m as normalize, d as dot, k as cross, s as subtract, o as multiplyAccumulate, x as multiplyScalar, T as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
|
+
import { getOtherLineName, updateState, boundPointOnPlane, getLinePlaneName, getLineInPlaneName, rotateVector } from './helpers.js';
|
|
8
|
+
import { InteractionMethodsName, lineNames, ScrollingMethods, planeNameToViewType } from './Constants.js';
|
|
9
9
|
|
|
10
10
|
function widgetBehavior(publicAPI, model) {
|
|
11
11
|
model._isDragging = false;
|
|
12
|
-
var isScrolling = false; //
|
|
12
|
+
var isScrolling = false; // FIXME: label information should be accessible from activeState instead of parent state.
|
|
13
|
+
|
|
14
|
+
publicAPI.getActiveInteraction = function () {
|
|
15
|
+
if (model.widgetState.getStatesWithLabel('rotation').includes(model.activeState)) {
|
|
16
|
+
return InteractionMethodsName.RotateLine;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (model.widgetState.getStatesWithLabel('line').includes(model.activeState)) {
|
|
20
|
+
return InteractionMethodsName.TranslateAxis;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (model.widgetState.getStatesWithLabel('center').includes(model.activeState)) {
|
|
24
|
+
return InteractionMethodsName.TranslateCenter;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* ActiveState can be RotationHandle or a LineHandle
|
|
31
|
+
* @returns 'YinX', 'ZinX', 'XinY', 'ZinY', 'XinZ' or 'YinZ'
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
publicAPI.getActiveLineName = function () {
|
|
36
|
+
return lineNames.find(function (lineName) {
|
|
37
|
+
return model.widgetState.getStatesWithLabel(lineName).includes(model.activeState);
|
|
38
|
+
});
|
|
39
|
+
}; // FIXME: label information should be accessible from activeState instead of parent state.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
publicAPI.getActiveLineHandle = function () {
|
|
43
|
+
var _model$widgetState$, _model$widgetState;
|
|
44
|
+
|
|
45
|
+
return (_model$widgetState$ = (_model$widgetState = model.widgetState)["getAxis".concat(publicAPI.getActiveLineName())]) === null || _model$widgetState$ === void 0 ? void 0 : _model$widgetState$.call(_model$widgetState);
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Return the line handle of the other line in the same view.
|
|
49
|
+
* @param {string} lineName name of the line (YinX, ZinX, XinY, ZinY, XinZ, YinZ)
|
|
50
|
+
* @returns ZinX if lineName == YinX, YinX if lineName == ZinX, ZinY if lineName == XinY...
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
publicAPI.getOtherLineHandle = function (lineName) {
|
|
55
|
+
var _model$widgetState$2, _model$widgetState2;
|
|
56
|
+
|
|
57
|
+
return (_model$widgetState$2 = (_model$widgetState2 = model.widgetState)["getAxis".concat(getOtherLineName(lineName))]) === null || _model$widgetState$2 === void 0 ? void 0 : _model$widgetState$2.call(_model$widgetState2);
|
|
58
|
+
}; // FIXME: label information should be accessible from activeState instead of parent state.
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* There are 2 rotation handles per axis: 'point0' and 'point1'.
|
|
62
|
+
* This function returns which rotation handle (point0 or point1) is currently active.
|
|
63
|
+
* ActiveState must be a RotationHandle.
|
|
64
|
+
* @returns 'point0' or 'point1'
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
publicAPI.getActiveRotationPointName = function () {
|
|
69
|
+
return model.widgetState.getStatesWithLabel('point0').includes(model.activeState) ? 'point0' : 'point1';
|
|
70
|
+
}; // Reset "updateMethodName" attribute when no actors are selected
|
|
13
71
|
// Useful to update 'updateMethodeName' to the correct name which
|
|
14
72
|
// will be TranslateCenter by default
|
|
15
73
|
|
|
74
|
+
|
|
16
75
|
publicAPI.resetUpdateMethod = function () {
|
|
17
76
|
if (model.representations.length !== 0) {
|
|
18
77
|
model.representations[0].getSelectedState();
|
|
@@ -35,7 +94,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
35
94
|
};
|
|
36
95
|
|
|
37
96
|
publicAPI.updateCursor = function () {
|
|
38
|
-
switch (
|
|
97
|
+
switch (publicAPI.getActiveInteraction()) {
|
|
39
98
|
case InteractionMethodsName.TranslateCenter:
|
|
40
99
|
model._apiSpecificRenderWindow.setCursor('move');
|
|
41
100
|
|
|
@@ -61,7 +120,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
61
120
|
publicAPI.handleLeftButtonPress = function (callData) {
|
|
62
121
|
if (model.activeState && model.activeState.getActive()) {
|
|
63
122
|
model._isDragging = true;
|
|
64
|
-
var viewType = model.
|
|
123
|
+
var viewType = model.viewType;
|
|
65
124
|
var currentPlaneNormal = model.widgetState.getPlanes()[viewType].normal;
|
|
66
125
|
model.planeManipulator.setWidgetOrigin(model.widgetState.getCenter());
|
|
67
126
|
model.planeManipulator.setWidgetNormal(currentPlaneNormal);
|
|
@@ -145,7 +204,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
145
204
|
|
|
146
205
|
publicAPI.handleEvent = function (callData) {
|
|
147
206
|
if (model.activeState.getActive()) {
|
|
148
|
-
publicAPI[
|
|
207
|
+
publicAPI[publicAPI.getActiveInteraction()](callData);
|
|
149
208
|
publicAPI.invokeInternalInteractionEvent();
|
|
150
209
|
return macro.EVENT_ABORT;
|
|
151
210
|
}
|
|
@@ -154,7 +213,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
154
213
|
};
|
|
155
214
|
|
|
156
215
|
publicAPI.invokeInternalInteractionEvent = function () {
|
|
157
|
-
var methodName =
|
|
216
|
+
var methodName = publicAPI.getActiveInteraction();
|
|
158
217
|
var computeFocalPointOffset = methodName !== InteractionMethodsName.RotateLine;
|
|
159
218
|
var canUpdateFocalPoint = methodName === InteractionMethodsName.RotateLine;
|
|
160
219
|
publicAPI.invokeInteractionEvent({
|
|
@@ -194,22 +253,20 @@ function widgetBehavior(publicAPI, model) {
|
|
|
194
253
|
var newCenter = [oldCenter[0] + movingFactor * dirProj[0], oldCenter[1] + movingFactor * dirProj[1], oldCenter[2] + movingFactor * dirProj[2]];
|
|
195
254
|
newCenter = publicAPI.getBoundedCenter(newCenter);
|
|
196
255
|
model.widgetState.setCenter(newCenter);
|
|
197
|
-
updateState(model.widgetState);
|
|
256
|
+
updateState(model.widgetState, model._factory.getDisplayScaleParams(), model._factory.getRotationHandlePosition());
|
|
198
257
|
};
|
|
199
258
|
|
|
200
259
|
publicAPI[InteractionMethodsName.TranslateAxis] = function (calldata) {
|
|
201
|
-
var
|
|
202
|
-
var
|
|
203
|
-
var
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
var
|
|
208
|
-
var otherLineVector =
|
|
260
|
+
var lineHandle = publicAPI.getActiveLineHandle();
|
|
261
|
+
var lineName = publicAPI.getActiveLineName();
|
|
262
|
+
var pointOnLine = add(lineHandle.getOrigin(), lineHandle.getDirection(), []);
|
|
263
|
+
var currentLineVector = lineHandle.getDirection();
|
|
264
|
+
normalize(currentLineVector); // Translate the current line along the other line
|
|
265
|
+
|
|
266
|
+
var otherLineHandle = publicAPI.getOtherLineHandle(lineName);
|
|
267
|
+
var otherLineVector = otherLineHandle.getDirection();
|
|
209
268
|
normalize(otherLineVector);
|
|
210
269
|
var axisTranslation = otherLineVector;
|
|
211
|
-
var currentLineVector = subtract(point2, point1, [0, 0, 0]);
|
|
212
|
-
normalize(currentLineVector);
|
|
213
270
|
var dot$1 = dot(currentLineVector, otherLineVector); // lines are colinear, translate along perpendicular axis from current line
|
|
214
271
|
|
|
215
272
|
if (dot$1 === 1 || dot$1 === -1) {
|
|
@@ -217,14 +274,15 @@ function widgetBehavior(publicAPI, model) {
|
|
|
217
274
|
}
|
|
218
275
|
|
|
219
276
|
var closestPoint = [];
|
|
220
|
-
|
|
277
|
+
var worldCoords = model.planeManipulator.handleEvent(calldata, model._apiSpecificRenderWindow);
|
|
278
|
+
vtkLine.distanceToLine(worldCoords, lineHandle.getOrigin(), pointOnLine, closestPoint);
|
|
221
279
|
var translationVector = subtract(worldCoords, closestPoint, []);
|
|
222
280
|
var translationDistance = dot(translationVector, axisTranslation);
|
|
223
281
|
var center = model.widgetState.getCenter();
|
|
224
282
|
var newOrigin = multiplyAccumulate(center, axisTranslation, translationDistance, [0, 0, 0]);
|
|
225
283
|
newOrigin = publicAPI.getBoundedCenter(newOrigin);
|
|
226
284
|
model.widgetState.setCenter(newOrigin);
|
|
227
|
-
updateState(model.widgetState);
|
|
285
|
+
updateState(model.widgetState, model._factory.getDisplayScaleParams(), model._factory.getRotationHandlePosition());
|
|
228
286
|
};
|
|
229
287
|
|
|
230
288
|
publicAPI.getBoundedCenter = function (newCenter) {
|
|
@@ -241,19 +299,19 @@ function widgetBehavior(publicAPI, model) {
|
|
|
241
299
|
publicAPI[InteractionMethodsName.TranslateCenter] = function (calldata) {
|
|
242
300
|
var worldCoords = model.planeManipulator.handleEvent(calldata, model._apiSpecificRenderWindow);
|
|
243
301
|
worldCoords = publicAPI.getBoundedCenter(worldCoords);
|
|
244
|
-
model.
|
|
245
|
-
updateState(model.widgetState);
|
|
302
|
+
model.widgetState.setCenter(worldCoords);
|
|
303
|
+
updateState(model.widgetState, model._factory.getDisplayScaleParams(), model._factory.getRotationHandlePosition());
|
|
246
304
|
};
|
|
247
305
|
|
|
248
306
|
publicAPI[InteractionMethodsName.RotateLine] = function (calldata) {
|
|
249
|
-
var
|
|
307
|
+
var activeLineHandle = publicAPI.getActiveLineHandle();
|
|
250
308
|
var planeNormal = model.planeManipulator.getWidgetNormal();
|
|
251
309
|
var worldCoords = model.planeManipulator.handleEvent(calldata, model._apiSpecificRenderWindow);
|
|
252
310
|
var center = model.widgetState.getCenter();
|
|
253
|
-
var previousLineDirection =
|
|
311
|
+
var previousLineDirection = activeLineHandle.getDirection();
|
|
254
312
|
normalize(previousLineDirection);
|
|
255
313
|
|
|
256
|
-
if (
|
|
314
|
+
if (publicAPI.getActiveRotationPointName() === 'point0') {
|
|
257
315
|
multiplyScalar(previousLineDirection, -1);
|
|
258
316
|
}
|
|
259
317
|
|
|
@@ -261,29 +319,28 @@ function widgetBehavior(publicAPI, model) {
|
|
|
261
319
|
subtract(worldCoords, center, currentVectorToOrigin);
|
|
262
320
|
normalize(currentVectorToOrigin);
|
|
263
321
|
var radianAngle = signedAngleBetweenVectors(previousLineDirection, currentVectorToOrigin, planeNormal);
|
|
264
|
-
publicAPI.rotateLineInView(
|
|
322
|
+
publicAPI.rotateLineInView(publicAPI.getActiveLineName(), radianAngle);
|
|
265
323
|
};
|
|
266
324
|
/**
|
|
267
325
|
* Rotate a line by a specified angle
|
|
268
|
-
* @param {
|
|
326
|
+
* @param {string} lineName The line name to rotate (e.g. YinX, ZinX, XinY, ZinY, XinZ, YinZ)
|
|
269
327
|
* @param {Number} radianAngle Applied angle in radian
|
|
270
328
|
*/
|
|
271
329
|
|
|
272
330
|
|
|
273
|
-
publicAPI.rotateLineInView = function (
|
|
274
|
-
var viewType =
|
|
275
|
-
var inViewType =
|
|
331
|
+
publicAPI.rotateLineInView = function (lineName, radianAngle) {
|
|
332
|
+
var viewType = planeNameToViewType[getLinePlaneName(lineName)];
|
|
333
|
+
var inViewType = planeNameToViewType[getLineInPlaneName(lineName)];
|
|
276
334
|
var planeNormal = model.widgetState.getPlanes()[inViewType].normal;
|
|
277
335
|
publicAPI.rotatePlane(viewType, radianAngle, planeNormal);
|
|
278
336
|
|
|
279
337
|
if (model.widgetState.getKeepOrthogonality()) {
|
|
280
|
-
var
|
|
281
|
-
var
|
|
282
|
-
|
|
283
|
-
publicAPI.rotatePlane(associatedViewType, radianAngle, planeNormal);
|
|
338
|
+
var otherLineName = getOtherLineName(lineName);
|
|
339
|
+
var otherPlaneName = getLinePlaneName(otherLineName);
|
|
340
|
+
publicAPI.rotatePlane(planeNameToViewType[otherPlaneName], radianAngle, planeNormal);
|
|
284
341
|
}
|
|
285
342
|
|
|
286
|
-
updateState(model.widgetState);
|
|
343
|
+
updateState(model.widgetState, model._factory.getDisplayScaleParams(), model._factory.getRotationHandlePosition());
|
|
287
344
|
};
|
|
288
345
|
/**
|
|
289
346
|
* Rotate a specified plane around an other specified plane.
|