@kitware/vtk.js 30.5.3 → 30.6.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/Base64.d.ts +2 -2
- package/Common/Core/CellArray.d.ts +45 -42
- package/Common/Core/DataArray.d.ts +465 -449
- package/Common/Core/Endian.d.ts +5 -5
- package/Common/Core/HalfFloat.d.ts +3 -3
- package/Common/Core/ImageHelper.d.ts +11 -5
- package/Common/Core/LookupTable.d.ts +260 -257
- package/Common/Core/Math.d.ts +461 -270
- package/Common/Core/MatrixBuilder.d.ts +117 -112
- package/Common/Core/Points.d.ts +114 -106
- package/Common/Core/PriorityQueue.d.ts +34 -30
- package/Common/Core/ProgressHandler.d.ts +44 -39
- package/Common/Core/ScalarsToColors/Constants.d.ts +9 -9
- package/Common/Core/ScalarsToColors.d.ts +351 -326
- package/Common/Core/StringArray.d.ts +94 -89
- package/Common/Core/URLExtract.d.ts +9 -6
- package/Common/Core/VariantArray.d.ts +94 -89
- package/Common/DataModel/AbstractPointLocator.d.ts +18 -18
- package/Common/DataModel/Box.d.ts +60 -52
- package/Common/DataModel/CardinalSpline1D.d.ts +59 -34
- package/Common/DataModel/Cell.d.ts +70 -67
- package/Common/DataModel/Collection.d.ts +100 -84
- package/Common/DataModel/Cone.d.ts +30 -27
- package/Common/DataModel/Cylinder.d.ts +122 -112
- package/Common/DataModel/DataSet/Constants.d.ts +9 -9
- package/Common/DataModel/DataSet.d.ts +38 -35
- package/Common/DataModel/DataSetAttributes/FieldData.d.ts +217 -206
- package/Common/DataModel/DataSetAttributes.d.ts +420 -415
- package/Common/DataModel/EdgeLocator.d.ts +82 -79
- package/Common/DataModel/ITKHelper.d.ts +33 -22
- package/Common/DataModel/ImageData.d.ts +362 -340
- package/Common/DataModel/IncrementalOctreeNode.d.ts +242 -242
- package/Common/DataModel/IncrementalOctreePointLocator.d.ts +16 -16
- package/Common/DataModel/KochanekSpline1D.d.ts +60 -36
- package/Common/DataModel/Line.d.ts +104 -83
- package/Common/DataModel/Locator.d.ts +10 -10
- package/Common/DataModel/PiecewiseFunction.d.ts +215 -199
- package/Common/DataModel/Plane.d.ts +255 -223
- package/Common/DataModel/PointSet.d.ts +32 -28
- package/Common/DataModel/PolyData/Constants.d.ts +2 -2
- package/Common/DataModel/PolyData.d.ts +143 -140
- package/Common/DataModel/PolyLine.d.ts +51 -28
- package/Common/DataModel/Polygon.d.ts +34 -33
- package/Common/DataModel/SelectionNode/Constants.d.ts +18 -18
- package/Common/DataModel/SelectionNode.d.ts +62 -56
- package/Common/DataModel/Sphere.d.ts +74 -72
- package/Common/DataModel/Spline1D.d.ts +60 -40
- package/Common/DataModel/Spline3D/Constants.d.ts +3 -3
- package/Common/DataModel/Spline3D.d.ts +27 -22
- package/Common/Transform/LandmarkTransform.d.ts +67 -64
- package/Common/Transform/Transform.d.ts +148 -126
- package/Filters/General/AppendPolyData.d.ts +43 -37
- package/Filters/General/ClipClosedSurface.d.ts +41 -41
- package/Filters/General/ContourTriangulator.d.ts +38 -38
- package/Filters/General/ImageCropFilter.d.ts +48 -44
- package/Filters/General/ImageDataOutlineFilter.d.ts +41 -37
- package/Filters/General/ImageOutlineFilter.d.ts +41 -37
- package/Filters/General/ImageSliceFilter.d.ts +38 -34
- package/Filters/General/ImageStreamline.d.ts +120 -93
- package/Filters/General/LineFilter.d.ts +18 -15
- package/Filters/General/OutlineFilter.d.ts +19 -16
- package/Filters/General/TriangleFilter.d.ts +23 -19
- package/Filters/General/TubeFilter.d.ts +194 -188
- package/Filters/Sources/Arrow2DSource.d.ts +151 -143
- package/Filters/Sources/ArrowSource.d.ts +148 -140
- package/Filters/Sources/CircleSource.d.ts +138 -130
- package/Filters/Sources/ConeSource.d.ts +167 -159
- package/Filters/Sources/CubeSource.d.ts +198 -181
- package/Filters/Sources/Cursor3D.d.ts +171 -164
- package/Filters/Sources/CylinderSource.d.ts +173 -166
- package/Filters/Sources/LineSource.d.ts +100 -92
- package/Filters/Sources/PlaneSource.d.ts +211 -203
- package/Filters/Sources/PointSource.d.ts +90 -82
- package/Filters/Sources/SphereSource.d.ts +171 -164
- package/Filters/Texture/TextureMapToPlane.d.ts +213 -208
- package/Filters/Texture/TextureMapToSphere.d.ts +77 -72
- package/IO/Core/DataAccessHelper/HtmlDataAccessHelper.d.ts +18 -5
- package/IO/Core/DataAccessHelper/HttpDataAccessHelper.d.ts +18 -5
- package/IO/Core/DataAccessHelper/JSZipDataAccessHelper.d.ts +19 -6
- package/IO/Core/DataAccessHelper/LiteHttpDataAccessHelper.d.ts +18 -5
- package/IO/Core/DataAccessHelper.d.ts +36 -22
- package/IO/Core/HttpDataSetReader.d.ts +279 -249
- package/IO/Core/HttpSceneLoader.d.ts +92 -87
- package/IO/Core/ImageStream/DefaultProtocol.d.ts +27 -20
- package/IO/Core/ImageStream/ViewStream.d.ts +7 -7
- package/IO/Core/ImageStream.d.ts +52 -47
- package/IO/Core/WSLinkClient.d.ts +12 -6
- package/IO/Geometry/DracoReader.d.ts +106 -88
- package/IO/Geometry/PLYReader.d.ts +92 -75
- package/IO/Geometry/PLYWriter.d.ts +163 -148
- package/IO/Geometry/STLReader.d.ts +92 -77
- package/IO/Geometry/STLWriter.d.ts +50 -42
- package/IO/Misc/ElevationReader.d.ts +155 -139
- package/IO/Misc/ITKImageReader.d.ts +58 -50
- package/IO/Misc/ITKPolyDataReader.d.ts +58 -50
- package/IO/Misc/JSONNucleoReader.d.ts +74 -57
- package/IO/Misc/JSONReader.d.ts +78 -72
- package/IO/Misc/MTLReader.d.ts +143 -130
- package/IO/Misc/OBJReader.d.ts +129 -110
- package/IO/Misc/PDBReader.d.ts +109 -93
- package/IO/XML/XMLImageDataReader.d.ts +31 -19
- package/IO/XML/XMLPolyDataReader.d.ts +31 -19
- package/IO/XML/XMLReader.d.ts +141 -105
- package/Imaging/Core/AbstractImageInterpolator/Constants.d.ts +2 -2
- package/Imaging/Core/ImageReslice.d.ts +231 -173
- package/Interaction/Style/InteractorStyleHMDXR.d.ts +7 -3
- package/Interaction/Style/InteractorStyleImage.d.ts +5 -4
- package/Interaction/Style/InteractorStyleTrackballCamera.d.ts +17 -6
- package/Interaction/Widgets/OrientationMarkerWidget/Constants.d.ts +5 -5
- package/Interaction/Widgets/OrientationMarkerWidget.d.ts +146 -142
- package/Proxy/Core/ViewProxy.d.ts +1 -1
- package/Proxy/Representations/GeometryRepresentationProxy.d.ts +28 -27
- package/Proxy/Representations/ResliceRepresentationProxy.d.ts +0 -1
- package/Rendering/Core/AbstractImageMapper.d.ts +125 -113
- package/Rendering/Core/AbstractMapper.d.ts +58 -52
- package/Rendering/Core/AbstractMapper3D.d.ts +32 -25
- package/Rendering/Core/AbstractPicker.d.ts +91 -88
- package/Rendering/Core/Actor.d.ts +117 -114
- package/Rendering/Core/Actor2D.d.ts +101 -98
- package/Rendering/Core/AnnotatedCubeActor.d.ts +58 -53
- package/Rendering/Core/AxesActor.d.ts +10 -4
- package/Rendering/Core/Camera.d.ts +739 -727
- package/Rendering/Core/CellPicker.d.ts +87 -77
- package/Rendering/Core/ColorTransferFunction/Constants.d.ts +2 -2
- package/Rendering/Core/ColorTransferFunction/CssFilters.d.ts +39 -13
- package/Rendering/Core/ColorTransferFunction.d.ts +3 -6
- package/Rendering/Core/Coordinate/Constants.d.ts +1 -1
- package/Rendering/Core/Coordinate.d.ts +154 -150
- package/Rendering/Core/Follower.d.ts +52 -47
- package/Rendering/Core/Glyph3DMapper/Constants.d.ts +8 -8
- package/Rendering/Core/Glyph3DMapper.d.ts +152 -149
- package/Rendering/Core/ImageArrayMapper.d.ts +237 -213
- package/Rendering/Core/ImageCPRMapper/Constants.d.ts +4 -4
- package/Rendering/Core/ImageCPRMapper.d.ts +424 -392
- package/Rendering/Core/ImageMapper/Constants.d.ts +8 -8
- package/Rendering/Core/ImageMapper.d.ts +292 -268
- package/Rendering/Core/ImageProperty/Constants.d.ts +3 -3
- package/Rendering/Core/ImageProperty.d.ts +204 -197
- package/Rendering/Core/ImageResliceMapper/Constants.d.ts +5 -5
- package/Rendering/Core/ImageResliceMapper.d.ts +235 -210
- package/Rendering/Core/ImageSlice.d.ts +142 -136
- package/Rendering/Core/InteractorObserver.d.ts +41 -32
- package/Rendering/Core/Light.d.ts +321 -318
- package/Rendering/Core/Mapper/Constants.d.ts +14 -14
- package/Rendering/Core/Mapper.d.ts +539 -512
- package/Rendering/Core/Mapper2D.d.ts +342 -330
- package/Rendering/Core/Picker.d.ts +114 -106
- package/Rendering/Core/PixelSpaceCallbackMapper.d.ts +56 -40
- package/Rendering/Core/PointPicker.d.ts +42 -37
- package/Rendering/Core/Prop/Constants.d.ts +3 -3
- package/Rendering/Core/Prop.d.ts +274 -274
- package/Rendering/Core/Prop3D.d.ts +259 -257
- package/Rendering/Core/Property/Constants.d.ts +12 -12
- package/Rendering/Core/Property.d.ts +535 -531
- package/Rendering/Core/Property2D/Constants.d.ts +1 -1
- package/Rendering/Core/Property2D.d.ts +114 -109
- package/Rendering/Core/RenderWindow.d.ts +193 -191
- package/Rendering/Core/RenderWindowInteractor/Constants.d.ts +19 -19
- package/Rendering/Core/RenderWindowInteractor.d.ts +1335 -1219
- package/Rendering/Core/Renderer.d.ts +677 -663
- package/Rendering/Core/ScalarBarActor.d.ts +333 -322
- package/Rendering/Core/Skybox.d.ts +45 -42
- package/Rendering/Core/SphereMapper.d.ts +49 -44
- package/Rendering/Core/StickMapper.d.ts +49 -44
- package/Rendering/Core/Texture.d.ts +87 -80
- package/Rendering/Core/Viewport.d.ts +229 -222
- package/Rendering/Core/Volume.d.ts +78 -73
- package/Rendering/Core/VolumeMapper/Constants.d.ts +11 -11
- package/Rendering/Core/VolumeMapper.d.ts +295 -285
- package/Rendering/Core/VolumeProperty/Constants.d.ts +19 -19
- package/Rendering/Core/VolumeProperty.d.ts +375 -365
- package/Rendering/Misc/CanvasView.d.ts +148 -145
- package/Rendering/Misc/FullScreenRenderWindow.d.ts +111 -108
- package/Rendering/Misc/GenericRenderWindow.d.ts +69 -65
- package/Rendering/Misc/RenderWindowWithControlBar.d.ts +46 -39
- package/Rendering/Misc/SynchronizableRenderWindow/ObjectManager.d.ts +49 -29
- package/Rendering/Misc/SynchronizableRenderWindow.d.ts +51 -35
- package/Rendering/Misc/TextureLODsDownloader.d.ts +110 -106
- package/Rendering/OpenGL/BufferObject.d.ts +3 -2
- package/Rendering/OpenGL/RenderWindow.d.ts +456 -405
- package/Rendering/OpenGL/Texture.d.ts +66 -14
- package/Rendering/SceneGraph/RenderPass.d.ts +88 -83
- package/Rendering/SceneGraph/ViewNode.d.ts +150 -146
- package/Rendering/SceneGraph/ViewNodeFactory.d.ts +17 -12
- package/Rendering/WebXR/RenderWindowHelper/Constants.d.ts +5 -5
- package/Rendering/WebXR/RenderWindowHelper.d.ts +54 -49
- package/Widgets/Core/AbstractWidget.d.ts +30 -24
- package/Widgets/Core/AbstractWidgetFactory.d.ts +53 -33
- package/Widgets/Core/WidgetManager/Constants.d.ts +4 -4
- package/Widgets/Core/WidgetManager.d.ts +21 -15
- package/Widgets/Core/WidgetState.d.ts +11 -7
- package/Widgets/Manipulators/AbstractManipulator.d.ts +224 -191
- package/Widgets/Manipulators/AbstractManipulator.js +20 -0
- package/Widgets/Manipulators/CPRManipulator.js +3 -3
- package/Widgets/Manipulators/LineManipulator.d.ts +33 -21
- package/Widgets/Manipulators/LineManipulator.js +1 -1
- package/Widgets/Manipulators/PickerManipulator.d.ts +22 -18
- package/Widgets/Manipulators/PickerManipulator.js +2 -2
- package/Widgets/Manipulators/PlaneManipulator.d.ts +33 -22
- package/Widgets/Manipulators/PlaneManipulator.js +1 -1
- package/Widgets/Manipulators/TrackballManipulator.d.ts +40 -26
- package/Widgets/Manipulators/TrackballManipulator.js +2 -2
- package/Widgets/Representations/WidgetRepresentation.d.ts +62 -51
- package/Widgets/Widgets3D/AngleWidget/behavior.js +14 -7
- package/Widgets/Widgets3D/ImageCroppingWidget/behavior.js +19 -6
- package/Widgets/Widgets3D/ImplicitPlaneWidget.js +38 -8
- package/Widgets/Widgets3D/InteractiveOrientationWidget.d.ts +25 -10
- package/Widgets/Widgets3D/LabelWidget/behavior.js +14 -10
- package/Widgets/Widgets3D/LineWidget/behavior.js +22 -12
- package/Widgets/Widgets3D/PolyLineWidget/behavior.js +16 -4
- package/Widgets/Widgets3D/PolyLineWidget.js +0 -5
- package/Widgets/Widgets3D/ResliceCursorWidget/Constants.d.ts +26 -7
- package/Widgets/Widgets3D/ResliceCursorWidget/behavior.d.ts +13 -12
- package/Widgets/Widgets3D/ResliceCursorWidget.d.ts +26 -15
- package/Widgets/Widgets3D/SeedWidget/behavior.js +1 -7
- package/Widgets/Widgets3D/SeedWidget.d.ts +2 -2
- package/Widgets/Widgets3D/ShapeWidget/behavior.js +9 -8
- package/Widgets/Widgets3D/SphereWidget/behavior.js +20 -29
- package/Widgets/Widgets3D/SphereWidget.d.ts +5 -3
- package/Widgets/Widgets3D/SplineWidget/behavior.js +16 -4
- package/interfaces.d.ts +243 -243
- package/package.json +3 -3
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
vtkAbstractWidgetFactory,
|
|
3
|
+
IAbstractWidgetFactoryInitialValues,
|
|
4
|
+
} from './../Core/AbstractWidgetFactory';
|
|
5
|
+
import vtkAbstractWidget from './../Core/AbstractWidget';
|
|
3
6
|
import { Bounds } from './../../types';
|
|
4
7
|
import { ViewTypes } from './../Core/WidgetManager/Constants';
|
|
5
8
|
|
|
6
|
-
export interface vtkInteractiveOrientationWidget<
|
|
9
|
+
export interface vtkInteractiveOrientationWidget<
|
|
10
|
+
WidgetInstance extends vtkAbstractWidget = vtkAbstractWidget
|
|
11
|
+
> extends vtkAbstractWidgetFactory<WidgetInstance> {
|
|
7
12
|
/**
|
|
8
13
|
* Set the widget bounds
|
|
9
|
-
*
|
|
14
|
+
*
|
|
10
15
|
* @param {Bounds} bounds The widget bounds
|
|
11
16
|
*/
|
|
12
17
|
setBounds(bounds: Bounds): void;
|
|
@@ -17,7 +22,9 @@ export interface vtkInteractiveOrientationWidget<WidgetInstance extends vtkAbstr
|
|
|
17
22
|
getRepresentationForViewType(viewType: ViewTypes): unknown;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
|
-
export interface IInteractiveOrientationWidgetInitialValues<
|
|
25
|
+
export interface IInteractiveOrientationWidgetInitialValues<
|
|
26
|
+
WidgetInstance extends vtkAbstractWidget
|
|
27
|
+
> extends IAbstractWidgetFactoryInitialValues<WidgetInstance> {}
|
|
21
28
|
|
|
22
29
|
/**
|
|
23
30
|
* Method use to decorate a given object (publicAPI+model) with vtkInteractiveOrientationWidget characteristics.
|
|
@@ -26,18 +33,26 @@ export interface IInteractiveOrientationWidgetInitialValues<WidgetInstance exten
|
|
|
26
33
|
* @param model object on which data structure will be bounds (protected)
|
|
27
34
|
* @param {object} [initialValues] (default: {})
|
|
28
35
|
*/
|
|
29
|
-
export function extend<WidgetInstance extends vtkAbstractWidget>(
|
|
36
|
+
export function extend<WidgetInstance extends vtkAbstractWidget>(
|
|
37
|
+
publicAPI: object,
|
|
38
|
+
model: object,
|
|
39
|
+
initialValues?: IInteractiveOrientationWidgetInitialValues<WidgetInstance>
|
|
40
|
+
): void;
|
|
30
41
|
|
|
31
42
|
/**
|
|
32
43
|
* Creates a new instance of vtkInteractiveOrientationWidget
|
|
33
|
-
*
|
|
44
|
+
*
|
|
34
45
|
* @param {object} [initialValues] for pre-setting some of its content
|
|
35
46
|
*/
|
|
36
|
-
export function newInstance<
|
|
47
|
+
export function newInstance<
|
|
48
|
+
WidgetInstance extends vtkAbstractWidget = vtkAbstractWidget
|
|
49
|
+
>(
|
|
50
|
+
initialValues?: IInteractiveOrientationWidgetInitialValues<WidgetInstance>
|
|
51
|
+
): vtkInteractiveOrientationWidget<WidgetInstance>;
|
|
37
52
|
|
|
38
53
|
export declare const vtkInteractiveOrientationWidget: {
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
newInstance: typeof newInstance;
|
|
55
|
+
extend: typeof extend;
|
|
41
56
|
};
|
|
42
57
|
|
|
43
58
|
export default vtkInteractiveOrientationWidget;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../../macros2.js';
|
|
2
|
+
import { k as add } from '../../../Common/Core/Math/index.js';
|
|
2
3
|
|
|
3
4
|
function widgetBehavior(publicAPI, model) {
|
|
4
5
|
model.classHierarchy.push('vtkLabelWidgetProp');
|
|
@@ -37,10 +38,10 @@ function widgetBehavior(publicAPI, model) {
|
|
|
37
38
|
return macro.VOID;
|
|
38
39
|
}
|
|
39
40
|
const manipulator = model.activeState?.getManipulator?.() ?? model.manipulator;
|
|
41
|
+
const {
|
|
42
|
+
worldCoords
|
|
43
|
+
} = manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
40
44
|
if (model.activeState === model.widgetState.getMoveHandle() && manipulator) {
|
|
41
|
-
const {
|
|
42
|
-
worldCoords
|
|
43
|
-
} = manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
44
45
|
// Commit handle to location
|
|
45
46
|
const moveHandle = model.widgetState.getMoveHandle();
|
|
46
47
|
moveHandle.setOrigin(worldCoords);
|
|
@@ -87,14 +88,17 @@ function widgetBehavior(publicAPI, model) {
|
|
|
87
88
|
const manipulator = model.activeState?.getManipulator?.() ?? model.manipulator;
|
|
88
89
|
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
89
90
|
const {
|
|
90
|
-
worldCoords
|
|
91
|
+
worldCoords,
|
|
92
|
+
worldDelta
|
|
91
93
|
} = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
const isHandleMoving = model.widgetState.getMoveHandle() === model.activeState || model._isDragging;
|
|
95
|
+
if (!isHandleMoving || !worldCoords.length || !worldDelta.length) return macro.VOID;
|
|
96
|
+
const curOrigin = model.activeState.getOrigin();
|
|
97
|
+
const newOrigin = curOrigin ? add(curOrigin, worldDelta, []) : worldCoords;
|
|
98
|
+
model.activeState.setOrigin(newOrigin);
|
|
99
|
+
model.widgetState.getText().setOrigin(newOrigin);
|
|
100
|
+
publicAPI.invokeInteractionEvent();
|
|
101
|
+
return macro.EVENT_ABORT;
|
|
98
102
|
}
|
|
99
103
|
return macro.VOID;
|
|
100
104
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Constants from './Constants.js';
|
|
2
2
|
import { m as macro } from '../../../macros2.js';
|
|
3
|
-
import {
|
|
3
|
+
import { k as add, s as subtract, l as normalize } from '../../../Common/Core/Math/index.js';
|
|
4
4
|
import { getNumberOfPlacedHandles, isHandlePlaced, calculateTextPosition, updateTextPosition, getPoint } from './helpers.js';
|
|
5
5
|
|
|
6
6
|
const {
|
|
@@ -47,7 +47,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
47
47
|
function updateCursor(callData) {
|
|
48
48
|
model._isDragging = true;
|
|
49
49
|
const manipulator = model.activeState?.getManipulator?.() ?? model.manipulator;
|
|
50
|
-
|
|
50
|
+
manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
51
51
|
model._apiSpecificRenderWindow.setCursor('grabbing');
|
|
52
52
|
model._interactor.requestAnimation(publicAPI);
|
|
53
53
|
}
|
|
@@ -181,22 +181,32 @@ function widgetBehavior(publicAPI, model) {
|
|
|
181
181
|
const manipulator = model.activeState?.getManipulator?.() ?? model.manipulator;
|
|
182
182
|
if (manipulator && model.pickable && model.dragable && model.activeState && model.activeState.getActive() && !ignoreKey(callData)) {
|
|
183
183
|
const {
|
|
184
|
-
worldCoords
|
|
184
|
+
worldCoords,
|
|
185
|
+
worldDelta
|
|
185
186
|
} = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
186
|
-
const
|
|
187
|
-
model.previousPosition = worldCoords;
|
|
188
|
-
if (
|
|
187
|
+
const isHandleMoving =
|
|
189
188
|
// is placing first or second handle
|
|
190
189
|
model.activeState === model.widgetState.getMoveHandle() ||
|
|
191
190
|
// is dragging already placed first or second handle
|
|
192
|
-
model._isDragging
|
|
193
|
-
|
|
194
|
-
|
|
191
|
+
model._isDragging;
|
|
192
|
+
|
|
193
|
+
// the line state doesn't have setOrigin
|
|
194
|
+
const isDraggingLine = !model.activeState.setOrigin;
|
|
195
|
+
if (isHandleMoving) {
|
|
196
|
+
if (!isDraggingLine) {
|
|
197
|
+
const curOrigin = model.activeState.getOrigin();
|
|
198
|
+
if (curOrigin) {
|
|
199
|
+
model.activeState.setOrigin(add(model.activeState.getOrigin(), worldDelta, []));
|
|
200
|
+
} else {
|
|
201
|
+
model.activeState.setOrigin(worldCoords);
|
|
202
|
+
}
|
|
195
203
|
publicAPI.updateHandleVisibility(publicAPI.getHandleIndex(model.activeState));
|
|
196
204
|
} else {
|
|
197
|
-
// Dragging line
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
// Dragging line; move all handles
|
|
206
|
+
for (let i = 0; i < 2; i++) {
|
|
207
|
+
const handleOrigin = publicAPI.getHandle(i).getOrigin();
|
|
208
|
+
publicAPI.getHandle(i).setOrigin(add(handleOrigin, worldDelta, []));
|
|
209
|
+
}
|
|
200
210
|
}
|
|
201
211
|
publicAPI.updateHandleOrientations();
|
|
202
212
|
updateTextPosition(model);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../../macros2.js';
|
|
2
|
+
import { k as add } from '../../../Common/Core/Math/index.js';
|
|
2
3
|
|
|
3
4
|
function widgetBehavior(publicAPI, model) {
|
|
4
5
|
model.classHierarchy.push('vtkPolyLineWidgetProp');
|
|
@@ -23,11 +24,20 @@ function widgetBehavior(publicAPI, model) {
|
|
|
23
24
|
return macro.VOID;
|
|
24
25
|
}
|
|
25
26
|
const {
|
|
26
|
-
worldCoords
|
|
27
|
+
worldCoords,
|
|
28
|
+
worldDelta
|
|
27
29
|
} = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
const isHandleMoving = model.activeState === model.widgetState.getMoveHandle() || model._isDragging;
|
|
31
|
+
|
|
32
|
+
// the line is pickable but not draggable
|
|
33
|
+
const isPickingLine = !model.activeState.setOrigin;
|
|
34
|
+
if (worldCoords.length && isHandleMoving && !isPickingLine) {
|
|
35
|
+
const curOrigin = model.activeState.getOrigin();
|
|
36
|
+
if (curOrigin) {
|
|
37
|
+
model.activeState.setOrigin(add(curOrigin, worldDelta, []));
|
|
38
|
+
} else {
|
|
39
|
+
model.activeState.setOrigin(worldCoords);
|
|
40
|
+
}
|
|
31
41
|
publicAPI.invokeInteractionEvent();
|
|
32
42
|
return macro.EVENT_ABORT;
|
|
33
43
|
}
|
|
@@ -73,6 +83,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
73
83
|
newHandle.setScale1(moveHandle.getScale1());
|
|
74
84
|
newHandle.setManipulator(manipulator);
|
|
75
85
|
} else if (model.dragable) {
|
|
86
|
+
// Update worldDelta
|
|
87
|
+
manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
76
88
|
model._isDragging = true;
|
|
77
89
|
model._apiSpecificRenderWindow.setCursor('grabbing');
|
|
78
90
|
model._interactor.requestAnimation(publicAPI);
|
|
@@ -53,11 +53,6 @@ function vtkPolyLineWidget(publicAPI, model) {
|
|
|
53
53
|
// initialization
|
|
54
54
|
// --------------------------------------------------------------------------
|
|
55
55
|
|
|
56
|
-
model.widgetState.onBoundsChange(bounds => {
|
|
57
|
-
const center = [(bounds[0] + bounds[1]) * 0.5, (bounds[2] + bounds[3]) * 0.5, (bounds[4] + bounds[5]) * 0.5];
|
|
58
|
-
model.widgetState.getMoveHandle().setOrigin(center);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
56
|
// Default manipulator
|
|
62
57
|
publicAPI.setManipulator(model.manipulator || vtkPlanePointManipulator.newInstance({
|
|
63
58
|
useCameraFocalPoint: true,
|
|
@@ -2,7 +2,10 @@ import { Vector3 } from '../../../types';
|
|
|
2
2
|
import { ViewTypes } from '../../Core/WidgetManager/Constants';
|
|
3
3
|
|
|
4
4
|
// Different types of plane from ViewTypes:
|
|
5
|
-
export type PlaneViewType =
|
|
5
|
+
export type PlaneViewType =
|
|
6
|
+
| ViewTypes.YZ_PLANE
|
|
7
|
+
| ViewTypes.XZ_PLANE
|
|
8
|
+
| ViewTypes.XY_PLANE;
|
|
6
9
|
|
|
7
10
|
// 0, 1, 2 for X, Y, Z
|
|
8
11
|
export type AxisIndex = 0 | 1 | 2;
|
|
@@ -10,7 +13,6 @@ export type AxisIndex = 0 | 1 | 2;
|
|
|
10
13
|
// Should be X, Y, Z
|
|
11
14
|
export type PlaneName = typeof planeNames extends (infer U)[] ? U : never;
|
|
12
15
|
|
|
13
|
-
|
|
14
16
|
export declare enum ScrollingMethods {
|
|
15
17
|
MIDDLE_MOUSE_BUTTON = 0,
|
|
16
18
|
LEFT_MOUSE_BUTTON = 1,
|
|
@@ -26,19 +28,36 @@ export declare enum InteractionMethodsName {
|
|
|
26
28
|
TranslateCenterAndUpdatePlanes = 'translateCenterAndUpdatePlanes',
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
export declare const defaultViewUpFromViewType: {
|
|
31
|
+
export declare const defaultViewUpFromViewType: {
|
|
32
|
+
[plane in PlaneViewType]: Vector3;
|
|
33
|
+
};
|
|
30
34
|
|
|
31
|
-
export declare const xyzToViewType: [
|
|
35
|
+
export declare const xyzToViewType: [
|
|
36
|
+
PlaneViewType,
|
|
37
|
+
PlaneViewType,
|
|
38
|
+
PlaneViewType
|
|
39
|
+
];
|
|
32
40
|
|
|
33
41
|
export declare const viewTypeToXYZ: { [plane in PlaneViewType]: AxisIndex };
|
|
34
42
|
|
|
35
43
|
export declare const planeNames: ['X', 'Y', 'Z'];
|
|
36
44
|
|
|
37
|
-
export declare const viewTypeToPlaneName: {
|
|
45
|
+
export declare const viewTypeToPlaneName: {
|
|
46
|
+
[plane in PlaneViewType]: PlaneName;
|
|
47
|
+
};
|
|
38
48
|
|
|
39
|
-
export declare const planeNameToViewType: {
|
|
49
|
+
export declare const planeNameToViewType: {
|
|
50
|
+
[planeName in PlaneName]: PlaneViewType;
|
|
51
|
+
};
|
|
40
52
|
|
|
41
|
-
export declare const lineNames: [
|
|
53
|
+
export declare const lineNames: [
|
|
54
|
+
'YinX',
|
|
55
|
+
'ZinX',
|
|
56
|
+
'XinY',
|
|
57
|
+
'ZinY',
|
|
58
|
+
'XinZ',
|
|
59
|
+
'YinZ'
|
|
60
|
+
];
|
|
42
61
|
|
|
43
62
|
declare const _default: {
|
|
44
63
|
ScrollingMethods: typeof ScrollingMethods;
|
|
@@ -2,25 +2,26 @@ import { Nullable } from '../../../types';
|
|
|
2
2
|
import { InteractionMethodsName, lineNames } from './Constants';
|
|
3
3
|
import vtkAbstractWidget from '../../Core/AbstractWidget';
|
|
4
4
|
|
|
5
|
-
type TLineName =
|
|
5
|
+
type TLineName = typeof lineNames[number];
|
|
6
6
|
|
|
7
7
|
type TCursorStyles = {
|
|
8
|
-
|
|
8
|
+
[key in InteractionMethodsName]?: string;
|
|
9
9
|
} & {
|
|
10
|
-
default?: string
|
|
10
|
+
default?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export default interface vtkResliceCursorWidgetDefaultInstance
|
|
14
|
-
|
|
13
|
+
export default interface vtkResliceCursorWidgetDefaultInstance
|
|
14
|
+
extends vtkAbstractWidget {
|
|
15
|
+
getActiveInteraction(): Nullable<InteractionMethodsName>;
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
setKeepOrthogonality(keepOrthogonality: boolean): boolean;
|
|
18
|
+
getKeepOrthogonality(): boolean;
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
setCursorStyles(cursorStyles: TCursorStyles): boolean;
|
|
21
|
+
getCursorStyles(): TCursorStyles;
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
setEnableTranslation(enableTranslation: boolean): void;
|
|
24
|
+
setEnableRotation(enableRotation: boolean): void;
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
getActiveLineName(): TLineName | undefined;
|
|
26
27
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { mat4 } from 'gl-matrix';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
vtkAbstractWidgetFactory,
|
|
4
|
+
IAbstractWidgetFactoryInitialValues,
|
|
5
|
+
} from './../Core/AbstractWidgetFactory';
|
|
3
6
|
import vtkResliceCursorWidgetDefaultInstance from './ResliceCursorWidget/behavior';
|
|
4
|
-
import vtkAbstractWidget from './../Core/AbstractWidget'
|
|
7
|
+
import vtkAbstractWidget from './../Core/AbstractWidget';
|
|
5
8
|
import vtkImageData from './../../Common/DataModel/ImageData';
|
|
6
9
|
import vtkImageReslice from './../../Imaging/Core/ImageReslice';
|
|
7
10
|
import vtkPlaneSource from './../../Filters/Sources/PlaneSource';
|
|
@@ -11,15 +14,16 @@ import { ViewTypes } from './../Core/WidgetManager/Constants';
|
|
|
11
14
|
import { Vector2, Vector3 } from './../../types';
|
|
12
15
|
|
|
13
16
|
export interface IDisplayScaleParams {
|
|
14
|
-
dispHeightFactor: number
|
|
15
|
-
cameraPosition: Vector3
|
|
16
|
-
cameraDir: Vector3
|
|
17
|
-
isParallel: false
|
|
18
|
-
rendererPixelDims: Vector2
|
|
17
|
+
dispHeightFactor: number;
|
|
18
|
+
cameraPosition: Vector3;
|
|
19
|
+
cameraDir: Vector3;
|
|
20
|
+
isParallel: false;
|
|
21
|
+
rendererPixelDims: Vector2;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
export interface vtkResliceCursorWidget<
|
|
22
|
-
|
|
24
|
+
export interface vtkResliceCursorWidget<
|
|
25
|
+
WidgetInstance extends vtkAbstractWidget = vtkResliceCursorWidgetDefaultInstance
|
|
26
|
+
> extends vtkAbstractWidgetFactory<WidgetInstance> {
|
|
23
27
|
/**
|
|
24
28
|
* @param {ViewTypes} viewType
|
|
25
29
|
*/
|
|
@@ -43,12 +47,14 @@ export interface vtkResliceCursorWidget<WidgetInstance extends vtkAbstractWidget
|
|
|
43
47
|
keepCenterFocalDistance: boolean
|
|
44
48
|
): void;
|
|
45
49
|
|
|
46
|
-
|
|
47
50
|
getPlaneSource(viewType: ViewTypes): vtkPlaneSource;
|
|
48
51
|
|
|
49
52
|
getResliceAxes(viewType: ViewTypes): mat4;
|
|
50
53
|
|
|
51
|
-
updateReslicePlane(
|
|
54
|
+
updateReslicePlane(
|
|
55
|
+
imageReslice: vtkImageReslice,
|
|
56
|
+
viewType: ViewTypes
|
|
57
|
+
): boolean;
|
|
52
58
|
|
|
53
59
|
getPlaneSourceFromViewType(type: ViewTypes): vtkPlaneSource;
|
|
54
60
|
|
|
@@ -79,10 +85,11 @@ export interface vtkResliceCursorWidget<WidgetInstance extends vtkAbstractWidget
|
|
|
79
85
|
* @returns {Array<Vector3>} two Vector3 arrays (first and last points)
|
|
80
86
|
*/
|
|
81
87
|
getPlaneExtremities(viewType: ViewTypes): Array<Vector3>;
|
|
82
|
-
|
|
83
88
|
}
|
|
84
89
|
|
|
85
|
-
export interface IResliceCursorWidgetInitialValues<
|
|
90
|
+
export interface IResliceCursorWidgetInitialValues<
|
|
91
|
+
WidgetInstance extends vtkAbstractWidget
|
|
92
|
+
> extends IAbstractWidgetFactoryInitialValues<WidgetInstance> {}
|
|
86
93
|
|
|
87
94
|
/**
|
|
88
95
|
* Method used to decorate a given object (publicAPI+model) with vtkResliceCursorWidget characteristics.
|
|
@@ -99,10 +106,14 @@ export function extend<WidgetInstance extends vtkAbstractWidget>(
|
|
|
99
106
|
|
|
100
107
|
/**
|
|
101
108
|
* Method used to create a new instance of vtkResliceCursorWidget
|
|
102
|
-
*
|
|
109
|
+
*
|
|
103
110
|
* @param initialValues for pre-setting some of its content
|
|
104
111
|
*/
|
|
105
|
-
export function newInstance<
|
|
112
|
+
export function newInstance<
|
|
113
|
+
WidgetInstance extends vtkAbstractWidget = vtkResliceCursorWidgetDefaultInstance
|
|
114
|
+
>(
|
|
115
|
+
initialValues?: IResliceCursorWidgetInitialValues<WidgetInstance>
|
|
116
|
+
): vtkResliceCursorWidget<WidgetInstance>;
|
|
106
117
|
|
|
107
118
|
export declare const vtkResliceCursorWidget: {
|
|
108
119
|
newInstance: typeof newInstance;
|
|
@@ -5,7 +5,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
5
5
|
const moveHandle = model.widgetState.getMoveHandle();
|
|
6
6
|
moveHandle.setVisible(true);
|
|
7
7
|
model._isDragging = false;
|
|
8
|
-
model.previousPosition = null;
|
|
9
8
|
function isValidHandle(handle) {
|
|
10
9
|
return handle === moveHandle;
|
|
11
10
|
}
|
|
@@ -32,7 +31,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
32
31
|
if (model.activeState === moveHandle) {
|
|
33
32
|
if (!moveHandle.getOrigin() && worldCoords) {
|
|
34
33
|
moveHandle.setOrigin(worldCoords);
|
|
35
|
-
model.previousPosition = [...worldCoords];
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
model._isDragging = true;
|
|
@@ -46,7 +44,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
46
44
|
return macro.VOID;
|
|
47
45
|
}
|
|
48
46
|
if (isPlaced()) {
|
|
49
|
-
model.previousPosition = null;
|
|
50
47
|
model._widgetManager.enablePicking();
|
|
51
48
|
model._apiSpecificRenderWindow.setCursor('pointer');
|
|
52
49
|
model._isDragging = false;
|
|
@@ -63,10 +60,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
63
60
|
}
|
|
64
61
|
if (!model.activeState) throw Error('no activestate');
|
|
65
62
|
const worldCoords = currentWorldCoords(e);
|
|
66
|
-
|
|
67
|
-
model.activeState.setOrigin(worldCoords);
|
|
68
|
-
model.previousPosition = worldCoords;
|
|
69
|
-
}
|
|
63
|
+
model.activeState.setOrigin(worldCoords);
|
|
70
64
|
return macro.VOID;
|
|
71
65
|
};
|
|
72
66
|
publicAPI.grabFocus = () => {
|
|
@@ -5,11 +5,11 @@ export interface ISeedWidgetHandleState {
|
|
|
5
5
|
getOrigin(): Vector3;
|
|
6
6
|
setOrigin(arg: Vector3): void;
|
|
7
7
|
getColor3(): string;
|
|
8
|
-
setColor3(arg: string):void;
|
|
8
|
+
setColor3(arg: string): void;
|
|
9
9
|
getScale1(): number;
|
|
10
10
|
setScale1(arg: number): void;
|
|
11
11
|
getVisible(): boolean;
|
|
12
|
-
setVisible(arg: boolean):void
|
|
12
|
+
setVisible(arg: boolean): void;
|
|
13
13
|
setShape(arg: string): void;
|
|
14
14
|
getShape(): string;
|
|
15
15
|
}
|
|
@@ -295,7 +295,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
295
295
|
model.shapeHandle.setDirection(normal);
|
|
296
296
|
}
|
|
297
297
|
const {
|
|
298
|
-
worldCoords
|
|
298
|
+
worldCoords,
|
|
299
|
+
worldDelta
|
|
299
300
|
} = manipulator.handleEvent(callData, model._apiSpecificRenderWindow);
|
|
300
301
|
if (!worldCoords.length) {
|
|
301
302
|
return macro.VOID;
|
|
@@ -311,11 +312,11 @@ function widgetBehavior(publicAPI, model) {
|
|
|
311
312
|
}
|
|
312
313
|
} else if (model._isDragging) {
|
|
313
314
|
if (model.activeState === model.point1Handle) {
|
|
314
|
-
model.point1Handle.
|
|
315
|
-
model.point1
|
|
315
|
+
vtkMath.add(model.point1Handle.getOrigin(), worldDelta, model.point1);
|
|
316
|
+
model.point1Handle.setOrigin(model.point1);
|
|
316
317
|
} else {
|
|
317
|
-
model.point2Handle.
|
|
318
|
-
model.point2
|
|
318
|
+
vtkMath.add(model.point2Handle.getOrigin(), worldDelta, model.point2);
|
|
319
|
+
model.point2Handle.setOrigin(model.point2);
|
|
319
320
|
}
|
|
320
321
|
publicAPI.updateShapeBounds();
|
|
321
322
|
publicAPI.invokeInteractionEvent();
|
|
@@ -332,10 +333,10 @@ function widgetBehavior(publicAPI, model) {
|
|
|
332
333
|
if (!model.activeState || !model.activeState.getActive() || !model.pickable || !manipulator) {
|
|
333
334
|
return macro.VOID;
|
|
334
335
|
}
|
|
336
|
+
const {
|
|
337
|
+
worldCoords
|
|
338
|
+
} = manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
335
339
|
if (model.hasFocus) {
|
|
336
|
-
const {
|
|
337
|
-
worldCoords
|
|
338
|
-
} = manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
339
340
|
if (!model.point1) {
|
|
340
341
|
model.point1Handle.setOrigin(worldCoords);
|
|
341
342
|
publicAPI.placePoint1(model.point1Handle.getOrigin());
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { m as macro } from '../../../macros2.js';
|
|
2
|
+
import { k as add } from '../../../Common/Core/Math/index.js';
|
|
2
3
|
import { vec3 } from 'gl-matrix';
|
|
3
4
|
|
|
4
5
|
function widgetBehavior(publicAPI, model) {
|
|
@@ -10,8 +11,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
10
11
|
|
|
11
12
|
// Set while moving the center or border handle.
|
|
12
13
|
model._isDragging = false;
|
|
13
|
-
// The last world coordinate of the mouse cursor during dragging.
|
|
14
|
-
model.previousPosition = null;
|
|
15
14
|
model.classHierarchy.push('vtkSphereWidgetProp');
|
|
16
15
|
moveHandle.setVisible(true);
|
|
17
16
|
centerHandle.setVisible(false);
|
|
@@ -47,7 +46,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
47
46
|
}
|
|
48
47
|
function currentWorldCoords(e) {
|
|
49
48
|
const manipulator = model.activeState?.getManipulator?.() ?? model.manipulator;
|
|
50
|
-
return manipulator.handleEvent(e, model._apiSpecificRenderWindow)
|
|
49
|
+
return manipulator.handleEvent(e, model._apiSpecificRenderWindow);
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
// Update the sphere's center and radius. Example:
|
|
@@ -75,19 +74,22 @@ function widgetBehavior(publicAPI, model) {
|
|
|
75
74
|
model.activeState = null;
|
|
76
75
|
return macro.VOID;
|
|
77
76
|
}
|
|
78
|
-
const
|
|
77
|
+
const {
|
|
78
|
+
worldCoords
|
|
79
|
+
} = currentWorldCoords(e);
|
|
79
80
|
if (model.activeState === moveHandle) {
|
|
80
81
|
// Initial sphere placement.
|
|
81
82
|
if (!centerHandle.getOrigin()) {
|
|
82
83
|
centerHandle.setOrigin(worldCoords);
|
|
83
84
|
} else if (!borderHandle.getOrigin()) {
|
|
84
85
|
borderHandle.setOrigin(worldCoords);
|
|
86
|
+
publicAPI.loseFocus();
|
|
85
87
|
}
|
|
86
88
|
updateSphere();
|
|
89
|
+
return macro.EVENT_ABORT;
|
|
87
90
|
}
|
|
88
91
|
model._isDragging = true;
|
|
89
92
|
model._apiSpecificRenderWindow.setCursor('grabbing');
|
|
90
|
-
model.previousPosition = [...currentWorldCoords(e)];
|
|
91
93
|
publicAPI.invokeStartInteractionEvent();
|
|
92
94
|
return macro.EVENT_ABORT;
|
|
93
95
|
};
|
|
@@ -97,7 +99,6 @@ function widgetBehavior(publicAPI, model) {
|
|
|
97
99
|
return macro.VOID;
|
|
98
100
|
}
|
|
99
101
|
if (isPlaced()) {
|
|
100
|
-
model.previousPosition = null;
|
|
101
102
|
model._widgetManager.enablePicking();
|
|
102
103
|
model._apiSpecificRenderWindow.setCursor('pointer');
|
|
103
104
|
model._isDragging = false;
|
|
@@ -108,43 +109,33 @@ function widgetBehavior(publicAPI, model) {
|
|
|
108
109
|
return macro.EVENT_ABORT;
|
|
109
110
|
};
|
|
110
111
|
publicAPI.handleMouseMove = e => {
|
|
111
|
-
if (!model.
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
if (!model.activeState) return macro.VOID;
|
|
113
|
+
const {
|
|
114
|
+
worldCoords,
|
|
115
|
+
worldDelta
|
|
116
|
+
} = currentWorldCoords(e);
|
|
117
|
+
if (model.hasFocus) {
|
|
118
|
+
model.activeState.setOrigin(worldCoords);
|
|
119
|
+
} else if (model._isDragging) {
|
|
120
|
+
model.activeState.setOrigin(add(model.activeState.getOrigin(), worldDelta, []));
|
|
114
121
|
}
|
|
115
|
-
if (!model.activeState) throw Error('no activestate');
|
|
116
|
-
const worldCoords = currentWorldCoords(e);
|
|
117
|
-
model.activeState.setOrigin(worldCoords);
|
|
118
|
-
if (model.activeState === centerHandle) {
|
|
119
|
-
// When the sphere is fully placed, and the user is moving the
|
|
120
|
-
// center, we move the whole sphere.
|
|
121
|
-
if (borderHandle.getOrigin()) {
|
|
122
|
-
if (!model.previousPosition) {
|
|
123
|
-
// !previousPosition here happens only immediately
|
|
124
|
-
// after grabFocus, but grabFocus resets
|
|
125
|
-
// borderHandle.origin.
|
|
126
|
-
throw Error(`no pos ${model.activeState} ${model.previousPosition}`);
|
|
127
|
-
}
|
|
128
|
-
const translation = vec3.sub(vec3.create(), worldCoords, model.previousPosition);
|
|
129
|
-
borderHandle.setOrigin(vec3.add(vec3.create(), borderHandle.getOrigin(), translation));
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
model.previousPosition = worldCoords;
|
|
133
122
|
updateSphere();
|
|
134
123
|
return macro.VOID;
|
|
135
124
|
};
|
|
125
|
+
const superGrabFocus = publicAPI.grabFocus;
|
|
136
126
|
publicAPI.grabFocus = () => {
|
|
127
|
+
superGrabFocus();
|
|
137
128
|
moveHandle.setVisible(true);
|
|
138
129
|
centerHandle.setVisible(false);
|
|
139
130
|
borderHandle.setVisible(false);
|
|
140
131
|
centerHandle.setOrigin(null);
|
|
141
132
|
borderHandle.setOrigin(null);
|
|
142
|
-
model._isDragging = true;
|
|
143
133
|
model.activeState = moveHandle;
|
|
144
134
|
model._interactor.render();
|
|
145
135
|
};
|
|
136
|
+
const superLoseFocus = publicAPI.loseFocus;
|
|
146
137
|
publicAPI.loseFocus = () => {
|
|
147
|
-
|
|
138
|
+
superLoseFocus();
|
|
148
139
|
model.activeState = null;
|
|
149
140
|
};
|
|
150
141
|
}
|
|
@@ -5,11 +5,11 @@ export interface ISphereWidgetHandleState {
|
|
|
5
5
|
getOrigin(): Vector3;
|
|
6
6
|
setOrigin(arg: Vector3): void;
|
|
7
7
|
getColor(): string;
|
|
8
|
-
setColor(arg: string):void;
|
|
8
|
+
setColor(arg: string): void;
|
|
9
9
|
getScale1(): number;
|
|
10
10
|
setScale1(arg: number): void;
|
|
11
11
|
getVisible(): boolean;
|
|
12
|
-
setVisible(arg: boolean):void
|
|
12
|
+
setVisible(arg: boolean): void;
|
|
13
13
|
setShape(arg: string): void;
|
|
14
14
|
getShape(): string;
|
|
15
15
|
}
|
|
@@ -41,7 +41,9 @@ export interface vtkSphereWidget {
|
|
|
41
41
|
|
|
42
42
|
export interface ISphereWidgetInitialValues {}
|
|
43
43
|
|
|
44
|
-
export function newInstance(
|
|
44
|
+
export function newInstance(
|
|
45
|
+
props?: ISphereWidgetInitialValues
|
|
46
|
+
): vtkSphereWidget;
|
|
45
47
|
|
|
46
48
|
export const vtkSphereWidget: {
|
|
47
49
|
newInstance: typeof newInstance;
|