@kitware/vtk.js 25.9.1 → 26.0.0-beta.1
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/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 +22 -14
- 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/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/SVG/SVGLandmarkRepresentation.js +1 -13
- package/Widgets/Widgets3D/AngleWidget.js +1 -4
- package/Widgets/Widgets3D/EllipseWidget/state.js +1 -1
- 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/index.d.ts +0 -1
- package/macros.d.ts +3 -5
- package/macros.js +4 -35
- package/package.json +2 -2
- package/Widgets/Representations/ResliceCursorContextRepresentation/Constants.js +0 -12
- package/Widgets/Representations/ResliceCursorContextRepresentation.d.ts +0 -54
- package/Widgets/Representations/ResliceCursorContextRepresentation.js +0 -357
- 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
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
3
|
import macro from '../../macros.js';
|
|
4
4
|
import vtkProp from '../../Rendering/Core/Prop.js';
|
|
5
|
-
import {
|
|
5
|
+
import { g as vtkMath } from '../../Common/Core/Math/index.js';
|
|
6
|
+
import vtkCellArray from '../../Common/Core/CellArray.js';
|
|
7
|
+
import vtkDataArray from '../../Common/Core/DataArray.js';
|
|
8
|
+
import vtkPoints from '../../Common/Core/Points.js';
|
|
6
9
|
import { Behavior } from './WidgetRepresentation/Constants.js';
|
|
7
10
|
import { RenderingTypes } from '../Core/WidgetManager/Constants.js';
|
|
8
11
|
import { CATEGORIES } from '../../Rendering/Core/Mapper/CoincidentTopologyHelper.js';
|
|
12
|
+
import { POLYDATA_FIELDS } from '../../Common/DataModel/PolyData/Constants.js';
|
|
9
13
|
|
|
10
14
|
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; }
|
|
11
15
|
|
|
@@ -67,10 +71,24 @@ function applyStyles(pipelines, styles, activeActor) {
|
|
|
67
71
|
} // ----------------------------------------------------------------------------
|
|
68
72
|
|
|
69
73
|
function connectPipeline(pipeline) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
var source = pipeline.source;
|
|
75
|
+
|
|
76
|
+
if (pipeline.filter) {
|
|
77
|
+
if (source.isA('vtkDataSet')) {
|
|
78
|
+
pipeline.filter.setInputData(source);
|
|
79
|
+
} else {
|
|
80
|
+
pipeline.filter.setInputConnection(source.getOutputPort());
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
source = pipeline.filter;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (source) {
|
|
87
|
+
if (source.isA('vtkDataSet')) {
|
|
88
|
+
pipeline.mapper.setInputData(source);
|
|
89
|
+
} else {
|
|
90
|
+
pipeline.mapper.setInputConnection(source.getOutputPort());
|
|
91
|
+
}
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
if (pipeline.glyph) {
|
|
@@ -78,16 +96,84 @@ function connectPipeline(pipeline) {
|
|
|
78
96
|
}
|
|
79
97
|
|
|
80
98
|
pipeline.actor.setMapper(pipeline.mapper);
|
|
99
|
+
}
|
|
100
|
+
function getPixelWorldHeightAtCoord(worldCoord, displayScaleParams) {
|
|
101
|
+
var dispHeightFactor = displayScaleParams.dispHeightFactor,
|
|
102
|
+
cameraPosition = displayScaleParams.cameraPosition,
|
|
103
|
+
cameraDir = displayScaleParams.cameraDir,
|
|
104
|
+
isParallel = displayScaleParams.isParallel,
|
|
105
|
+
rendererPixelDims = displayScaleParams.rendererPixelDims;
|
|
106
|
+
var scale = 1;
|
|
107
|
+
|
|
108
|
+
if (isParallel) {
|
|
109
|
+
scale = dispHeightFactor;
|
|
110
|
+
} else {
|
|
111
|
+
var worldCoordToCamera = _toConsumableArray(worldCoord);
|
|
112
|
+
|
|
113
|
+
vtkMath.subtract(worldCoordToCamera, cameraPosition, worldCoordToCamera);
|
|
114
|
+
scale = vtkMath.dot(worldCoordToCamera, cameraDir) * dispHeightFactor;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
var rHeight = rendererPixelDims[1];
|
|
118
|
+
return scale / rHeight;
|
|
119
|
+
} // Internal convenient function to create a data array:
|
|
120
|
+
|
|
121
|
+
function allocateArray(polyData, name, numberOfTuples, dataType, numberOfComponents) {
|
|
122
|
+
var _polyData$;
|
|
123
|
+
|
|
124
|
+
// Check first whether name is points, verts, lines, polys, otherwise it is a point data array.
|
|
125
|
+
var dataArray = ((_polyData$ = polyData["get".concat(macro.capitalize(name))]) === null || _polyData$ === void 0 ? void 0 : _polyData$.call(polyData)) || polyData.getPointData().getArrayByName(name);
|
|
126
|
+
|
|
127
|
+
if (!dataArray || dataType !== undefined && dataArray.getDataType() !== dataType || numberOfComponents !== undefined && dataArray.getNumberOfComponents() !== numberOfComponents) {
|
|
128
|
+
var arrayType = vtkDataArray;
|
|
129
|
+
var arrayDataType = dataType;
|
|
130
|
+
var arrayNumberOfComponents = numberOfComponents;
|
|
131
|
+
|
|
132
|
+
if (name === 'points') {
|
|
133
|
+
var _arrayDataType;
|
|
134
|
+
|
|
135
|
+
arrayType = vtkPoints;
|
|
136
|
+
arrayDataType = (_arrayDataType = arrayDataType) !== null && _arrayDataType !== void 0 ? _arrayDataType : 'Float32Array';
|
|
137
|
+
arrayNumberOfComponents = numberOfComponents !== null && numberOfComponents !== void 0 ? numberOfComponents : 3;
|
|
138
|
+
} else if (POLYDATA_FIELDS.includes(name)) {
|
|
139
|
+
var _arrayDataType2;
|
|
140
|
+
|
|
141
|
+
arrayType = vtkCellArray;
|
|
142
|
+
arrayDataType = (_arrayDataType2 = arrayDataType) !== null && _arrayDataType2 !== void 0 ? _arrayDataType2 : 'Uint16Array';
|
|
143
|
+
arrayNumberOfComponents = numberOfComponents !== null && numberOfComponents !== void 0 ? numberOfComponents : 1;
|
|
144
|
+
} else {
|
|
145
|
+
var _arrayDataType3;
|
|
146
|
+
|
|
147
|
+
// data array
|
|
148
|
+
arrayDataType = (_arrayDataType3 = arrayDataType) !== null && _arrayDataType3 !== void 0 ? _arrayDataType3 : 'Float32Array';
|
|
149
|
+
arrayNumberOfComponents = numberOfComponents !== null && numberOfComponents !== void 0 ? numberOfComponents : 1;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
dataArray = arrayType.newInstance({
|
|
153
|
+
name: name,
|
|
154
|
+
dataType: arrayDataType,
|
|
155
|
+
numberOfComponents: arrayNumberOfComponents,
|
|
156
|
+
size: arrayNumberOfComponents * numberOfTuples,
|
|
157
|
+
empty: numberOfTuples === 0
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
if (name === 'points' || POLYDATA_FIELDS.includes(name)) {
|
|
161
|
+
polyData["set".concat(macro.capitalize(name))](dataArray);
|
|
162
|
+
} else {
|
|
163
|
+
polyData.getPointData().addArray(dataArray);
|
|
164
|
+
}
|
|
165
|
+
} else if (dataArray.getNumberOfTuples() !== numberOfTuples) {
|
|
166
|
+
dataArray.resize(numberOfTuples);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return dataArray;
|
|
81
170
|
} // ----------------------------------------------------------------------------
|
|
82
171
|
// vtkWidgetRepresentation
|
|
83
172
|
// ----------------------------------------------------------------------------
|
|
84
173
|
|
|
85
174
|
function vtkWidgetRepresentation(publicAPI, model) {
|
|
86
175
|
// Set our className
|
|
87
|
-
model.classHierarchy.push('vtkWidgetRepresentation');
|
|
88
|
-
|
|
89
|
-
var superclass = _objectSpread({}, publicAPI); // Internal cache
|
|
90
|
-
|
|
176
|
+
model.classHierarchy.push('vtkWidgetRepresentation'); // Internal cache
|
|
91
177
|
|
|
92
178
|
var cache = {
|
|
93
179
|
mtimes: {},
|
|
@@ -217,35 +303,10 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
217
303
|
};
|
|
218
304
|
|
|
219
305
|
publicAPI.setCoincidentTopologyParameters = function (parameters) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
publicAPI.getPixelWorldHeightAtCoord = function (worldCoord) {
|
|
230
|
-
var _model$displayScalePa = model.displayScaleParams,
|
|
231
|
-
dispHeightFactor = _model$displayScalePa.dispHeightFactor,
|
|
232
|
-
cameraPosition = _model$displayScalePa.cameraPosition,
|
|
233
|
-
cameraDir = _model$displayScalePa.cameraDir,
|
|
234
|
-
isParallel = _model$displayScalePa.isParallel,
|
|
235
|
-
rendererPixelDims = _model$displayScalePa.rendererPixelDims;
|
|
236
|
-
var scale = 1;
|
|
237
|
-
|
|
238
|
-
if (isParallel) {
|
|
239
|
-
scale = dispHeightFactor;
|
|
240
|
-
} else {
|
|
241
|
-
var worldCoordToCamera = _toConsumableArray(worldCoord);
|
|
242
|
-
|
|
243
|
-
subtract(worldCoordToCamera, cameraPosition, worldCoordToCamera);
|
|
244
|
-
scale = dot(worldCoordToCamera, cameraDir) * dispHeightFactor;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
var rHeight = rendererPixelDims[1];
|
|
248
|
-
return scale / rHeight;
|
|
306
|
+
model.coincidentTopologyParameters = parameters;
|
|
307
|
+
publicAPI.getActors().forEach(function (actor) {
|
|
308
|
+
applyCoincidentTopologyParametersToMapper(actor.getMapper(), model.coincidentTopologyParameters);
|
|
309
|
+
});
|
|
249
310
|
}; // Make sure setting the labels at build time works with string/array...
|
|
250
311
|
|
|
251
312
|
|
|
@@ -255,49 +316,49 @@ function vtkWidgetRepresentation(publicAPI, model) {
|
|
|
255
316
|
// ----------------------------------------------------------------------------
|
|
256
317
|
|
|
257
318
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
319
|
+
function defaultValues(initialValues) {
|
|
320
|
+
return _objectSpread({
|
|
321
|
+
activeScaleFactor: 1.2,
|
|
322
|
+
activeColor: 1,
|
|
323
|
+
useActiveColor: true,
|
|
324
|
+
actors: [],
|
|
325
|
+
labels: [],
|
|
326
|
+
behavior: Behavior.CONTEXT,
|
|
327
|
+
coincidentTopologyParameters: {
|
|
328
|
+
Point: {
|
|
329
|
+
factor: -1.0,
|
|
330
|
+
offset: -1.0
|
|
331
|
+
},
|
|
332
|
+
Line: {
|
|
333
|
+
factor: -1.0,
|
|
334
|
+
offset: -1.0
|
|
335
|
+
},
|
|
336
|
+
Polygon: {
|
|
337
|
+
factor: -1.0,
|
|
338
|
+
offset: -1.0
|
|
339
|
+
}
|
|
266
340
|
},
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
341
|
+
scaleInPixels: false,
|
|
342
|
+
displayScaleParams: {
|
|
343
|
+
dispHeightFactor: 1,
|
|
344
|
+
cameraPosition: [0, 0, 0],
|
|
345
|
+
cameraDir: [1, 0, 0],
|
|
346
|
+
isParallel: false,
|
|
347
|
+
rendererPixelDims: [1, 1]
|
|
270
348
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
},
|
|
276
|
-
scaleInPixels: false,
|
|
277
|
-
displayScaleParams: {
|
|
278
|
-
dispHeightFactor: 1,
|
|
279
|
-
cameraPosition: [0, 0, 0],
|
|
280
|
-
cameraDir: [1, 0, 0],
|
|
281
|
-
isParallel: false,
|
|
282
|
-
rendererPixelDims: [1, 1]
|
|
283
|
-
}
|
|
284
|
-
}; // ----------------------------------------------------------------------------
|
|
349
|
+
_internalArrays: {}
|
|
350
|
+
}, initialValues);
|
|
351
|
+
} // ----------------------------------------------------------------------------
|
|
352
|
+
|
|
285
353
|
|
|
286
354
|
function extend(publicAPI, model) {
|
|
287
355
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
vtkProp.extend(publicAPI, model, initialValues);
|
|
356
|
+
// Object methods
|
|
357
|
+
vtkProp.extend(publicAPI, model, defaultValues(initialValues));
|
|
291
358
|
macro.algo(publicAPI, model, 1, 1);
|
|
292
|
-
macro.get(publicAPI, model, ['labels']);
|
|
293
|
-
macro.set(publicAPI, model, [
|
|
294
|
-
|
|
295
|
-
name: 'displayScaleParams'
|
|
296
|
-
}, {
|
|
297
|
-
type: 'object',
|
|
298
|
-
name: 'coincidentTopologyParameters'
|
|
299
|
-
}]);
|
|
300
|
-
macro.setGet(publicAPI, model, ['scaleInPixels']); // Object specific methods
|
|
359
|
+
macro.get(publicAPI, model, ['labels', 'coincidentTopologyParameters']);
|
|
360
|
+
macro.set(publicAPI, model, ['displayScaleParams']);
|
|
361
|
+
macro.setGet(publicAPI, model, ['scaleInPixels', 'activeScaleFactor', 'activeColor', 'useActiveColor']); // Object specific methods
|
|
301
362
|
|
|
302
363
|
vtkWidgetRepresentation(publicAPI, model);
|
|
303
364
|
} // ----------------------------------------------------------------------------
|
|
@@ -306,7 +367,8 @@ var vtkWidgetRepresentation$1 = {
|
|
|
306
367
|
extend: extend,
|
|
307
368
|
mergeStyles: mergeStyles,
|
|
308
369
|
applyStyles: applyStyles,
|
|
309
|
-
connectPipeline: connectPipeline
|
|
370
|
+
connectPipeline: connectPipeline,
|
|
371
|
+
getPixelWorldHeightAtCoord: getPixelWorldHeightAtCoord
|
|
310
372
|
};
|
|
311
373
|
|
|
312
|
-
export { applyStyles, connectPipeline, vtkWidgetRepresentation$1 as default, extend, mergeStyles };
|
|
374
|
+
export { allocateArray, applyStyles, connectPipeline, vtkWidgetRepresentation$1 as default, extend, getPixelWorldHeightAtCoord, mergeStyles };
|
|
@@ -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
|
|
|
@@ -152,19 +152,7 @@ function defaultValues(initialValues) {
|
|
|
152
152
|
function extend(publicAPI, model) {
|
|
153
153
|
var initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
154
154
|
vtkSVGRepresentation.extend(publicAPI, model, defaultValues(initialValues));
|
|
155
|
-
macro.setGet(publicAPI, model, [
|
|
156
|
-
type: 'object',
|
|
157
|
-
name: 'circleProps'
|
|
158
|
-
}, {
|
|
159
|
-
type: 'object',
|
|
160
|
-
name: 'fontProperties'
|
|
161
|
-
}, {
|
|
162
|
-
type: 'object',
|
|
163
|
-
name: 'strokeFontProperties'
|
|
164
|
-
}, {
|
|
165
|
-
type: 'object',
|
|
166
|
-
name: 'textProps'
|
|
167
|
-
}]); // Object specific methods
|
|
155
|
+
macro.setGet(publicAPI, model, ['circleProps', 'fontProperties', 'strokeFontProperties', 'textProps']); // Object specific methods
|
|
168
156
|
|
|
169
157
|
vtkSVGLandmarkRepresentation(publicAPI, model);
|
|
170
158
|
} // ----------------------------------------------------------------------------
|
|
@@ -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
|
|
@@ -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.
|