@kitware/vtk.js 30.1.2 → 30.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BREAKING_CHANGES.md +5 -3
- package/Rendering/Core/AxesActor.d.ts +101 -98
- package/Widgets/Core/WidgetManager.d.ts +17 -0
- package/Widgets/Core/WidgetManager.js +33 -18
- package/package.json +1 -1
- package/types.d.ts +1 -1
package/BREAKING_CHANGES.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
- **ResliceCursorWidget.invokeInternalInteractionEvent(methodName)**: has been removed and should be replaced by `ResliceCursorWidget.invokeInteractionEvent(methodName)`.
|
|
5
5
|
- **ResliceCursorWidget.updateCameraPoints(renderer, viewType, resetFocalPoint, keepCenterFocalDistance, computeFocalPointOffset)** has lost the `keepCenterFocalDistance` parameter (because it was ALWAYS the negate of `computeFocalPointOffset`). The new signature is `ResliceCursorWidget.updateCameraPoints(renderer, viewType, resetFocalPoint, keepCenterFocalDistance, computeFocalPointOffset)`
|
|
6
6
|
|
|
7
|
+
- **vtkAxesActor**: `setXAxisColor`, `setYAxisColor`, `setZAxisColor` now take a single `RGBColor` (array of 3 numbers) instead of 3 numbers for each color component. The `get*AxisColor` methods now return an array of 3 numbers instead of an object with `r`, `g`, `b` properties.
|
|
8
|
+
|
|
7
9
|
## From 28.x to 29
|
|
8
10
|
|
|
9
11
|
- **getOpenGLRenderWindow**: `getOpenGLRenderWindow` has been renamed to `getApiSpecificRenderWindow` in `vtkFullScreenRenderWindow`, `vtkGenericRenderWindow` and `vtkViewProxy` to support WebGL and WebGPU backend. ([#2816](https://github.com/Kitware/vtk-js/pull/2816))
|
|
@@ -83,9 +85,9 @@ SplineWidget's handles now scale up automatically.
|
|
|
83
85
|
|
|
84
86
|
## From 19.x to 20
|
|
85
87
|
|
|
86
|
-
In ShapeWidget:
|
|
87
|
-
- `setLabelTextCallback` is replaced by `text` substate.
|
|
88
|
-
- `setPixelScale` has been removed. It should be replaced by point handle `scale1` mixin and `scaleInPixels`.
|
|
88
|
+
In ShapeWidget:
|
|
89
|
+
- `setLabelTextCallback` is replaced by `text` substate.
|
|
90
|
+
- `setPixelScale` has been removed. It should be replaced by point handle `scale1` mixin and `scaleInPixels`.
|
|
89
91
|
- `useHandles` has been removed. It should be replaced by `setHandleVisibility`.
|
|
90
92
|
- `resetAfterPointPlacement` is now false by default.
|
|
91
93
|
|
|
@@ -1,99 +1,102 @@
|
|
|
1
1
|
import vtkActor, { IActorInitialValues } from './Actor';
|
|
2
|
+
import { RGBColor } from './../../types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Represents the initial values for the AxesActor.
|
|
5
6
|
*/
|
|
6
7
|
export interface IAxesActorInitialValues extends IActorInitialValues {}
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Represents an actor that displays axes in a 3D scene.
|
|
11
|
+
*/
|
|
8
12
|
export interface vtkAxesActor extends vtkActor {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
update(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Get config object of the actor.
|
|
15
|
+
*/
|
|
16
|
+
getConfig(): object;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get config object of the X axis.
|
|
20
|
+
*/
|
|
21
|
+
getXConfig(): object;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Get config object of the Y axis.
|
|
25
|
+
*/
|
|
26
|
+
getYConfig(): object;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Get config object of the Z axis.
|
|
30
|
+
*/
|
|
31
|
+
getZConfig(): object;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves the color of the X-axis.
|
|
35
|
+
*
|
|
36
|
+
* @return {RGBColor} The color of the X-axis.
|
|
37
|
+
*/
|
|
38
|
+
getXAxisColor(): RGBColor;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the color of the Y-axis.
|
|
42
|
+
*
|
|
43
|
+
* @return {RGBColor} The color of the Y-axis.
|
|
44
|
+
*/
|
|
45
|
+
getYAxisColor(): RGBColor;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Retrieves the color of the Z-axis.
|
|
49
|
+
*
|
|
50
|
+
* @return {RGBColor} The color of the Z-axis.
|
|
51
|
+
*/
|
|
52
|
+
getZAxisColor(): RGBColor;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Set config object of the actor.
|
|
56
|
+
* @param config
|
|
57
|
+
*/
|
|
58
|
+
setConfig(config: object): boolean;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Set config object of the X axis.
|
|
62
|
+
* @param config
|
|
63
|
+
*/
|
|
64
|
+
setXConfig(config: object): boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Set config object of the Y axis.
|
|
68
|
+
* @param config
|
|
69
|
+
*/
|
|
70
|
+
setYConfig(config: object): boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Set config object of the Z axis.
|
|
74
|
+
* @param config
|
|
75
|
+
*/
|
|
76
|
+
setZConfig(config: object): boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Set X axis color.
|
|
80
|
+
* @param {RGBColor} rgb An Array of the RGB color.
|
|
81
|
+
*/
|
|
82
|
+
setXAxisColor(rgb: RGBColor): boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Set Y axis color.
|
|
86
|
+
* @param {RGBColor} rgb An Array of the RGB color.
|
|
87
|
+
*/
|
|
88
|
+
setYAxisColor(rgb: RGBColor): boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Set Z axis color.
|
|
92
|
+
* @param {RGBColor} rgb An Array of the RGB color.
|
|
93
|
+
*/
|
|
94
|
+
setZAxisColor(rgb: RGBColor): boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Update the actor.
|
|
98
|
+
*/
|
|
99
|
+
update(): void;
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
/**
|
|
@@ -111,15 +114,15 @@ export function extend(publicAPI: object, model: object, initialValues?: IAxesAc
|
|
|
111
114
|
*/
|
|
112
115
|
export function newInstance(initialValues?: IAxesActorInitialValues): vtkAxesActor;
|
|
113
116
|
|
|
114
|
-
/**
|
|
115
|
-
* vtkAxesActor is a hybrid 2D/3D actor used to represent 3D axes in a scene.
|
|
116
|
-
* The user can define the geometry to use for the shaft or the tip,
|
|
117
|
-
* and the user can set the text for the three axes. The text will appear
|
|
118
|
-
* to follow the camera since it is implemented by means of vtkCaptionActor2D.
|
|
119
|
-
* All of the functionality of the underlying vtkCaptionActor2D objects are accessible so that,
|
|
120
|
-
* for instance, the font attributes of the axes text can be manipulated through vtkTextProperty.
|
|
121
|
-
* Since this class inherits from vtkProp3D, one can apply a user transform to the underlying
|
|
122
|
-
* geometry and the positioning of the labels. For example, a rotation transform could be used to
|
|
117
|
+
/**
|
|
118
|
+
* vtkAxesActor is a hybrid 2D/3D actor used to represent 3D axes in a scene.
|
|
119
|
+
* The user can define the geometry to use for the shaft or the tip,
|
|
120
|
+
* and the user can set the text for the three axes. The text will appear
|
|
121
|
+
* to follow the camera since it is implemented by means of vtkCaptionActor2D.
|
|
122
|
+
* All of the functionality of the underlying vtkCaptionActor2D objects are accessible so that,
|
|
123
|
+
* for instance, the font attributes of the axes text can be manipulated through vtkTextProperty.
|
|
124
|
+
* Since this class inherits from vtkProp3D, one can apply a user transform to the underlying
|
|
125
|
+
* geometry and the positioning of the labels. For example, a rotation transform could be used to
|
|
123
126
|
* generate a left-handed axes representation.
|
|
124
127
|
* @see [vtkAnnotatedCubeActor](./Rendering_Core_AnnotatedCubeActor.html)
|
|
125
128
|
* @see [vtkOrientationMarkerWidget](./Interaction_Widgets_OrientationMarkerWidget.html)
|
|
@@ -171,6 +171,23 @@ export interface vtkWidgetManager extends vtkObject {
|
|
|
171
171
|
* Release the focus.
|
|
172
172
|
*/
|
|
173
173
|
releaseFocus(): void;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Sets the default cursor styles.
|
|
177
|
+
*
|
|
178
|
+
* Known style keys:
|
|
179
|
+
* - default: when not interacting with a widget
|
|
180
|
+
* - hover: when hovering over a widget.
|
|
181
|
+
*
|
|
182
|
+
* If a known style key is not present, the cursor style will not be changed.
|
|
183
|
+
* @param {Record<string, string>} cursorStyles
|
|
184
|
+
*/
|
|
185
|
+
setCursorStyles(cursorStyles: Record<string, string>): boolean;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Retrieves the current cursor styles.
|
|
189
|
+
*/
|
|
190
|
+
getCursorStyles(): Record<string, string>;
|
|
174
191
|
}
|
|
175
192
|
|
|
176
193
|
export interface IWidgetManagerInitialValues {
|
|
@@ -157,7 +157,12 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
// Default cursor behavior
|
|
160
|
-
|
|
160
|
+
const cursorStyles = publicAPI.getCursorStyles();
|
|
161
|
+
const style = widget ? 'hover' : 'default';
|
|
162
|
+
const cursor = cursorStyles[style];
|
|
163
|
+
if (cursor) {
|
|
164
|
+
model._apiSpecificRenderWindow.setCursor(cursor);
|
|
165
|
+
}
|
|
161
166
|
model.activeWidget = null;
|
|
162
167
|
let wantRender = false;
|
|
163
168
|
if (model.widgetInFocus === widget && widget.hasFocus()) {
|
|
@@ -407,30 +412,40 @@ function vtkWidgetManager(publicAPI, model) {
|
|
|
407
412
|
// Object factory
|
|
408
413
|
// ----------------------------------------------------------------------------
|
|
409
414
|
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
415
|
+
const defaultValues = function () {
|
|
416
|
+
let initialValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
417
|
+
return {
|
|
418
|
+
// _camera: null,
|
|
419
|
+
// _selector: null,
|
|
420
|
+
// _currentUpdateSelectionCallID: null,
|
|
421
|
+
viewId: null,
|
|
422
|
+
widgets: [],
|
|
423
|
+
activeWidget: null,
|
|
424
|
+
renderer: null,
|
|
425
|
+
viewType: ViewTypes.DEFAULT,
|
|
426
|
+
isAnimating: false,
|
|
427
|
+
pickingEnabled: true,
|
|
428
|
+
selections: null,
|
|
429
|
+
previousSelectedData: null,
|
|
430
|
+
widgetInFocus: null,
|
|
431
|
+
captureOn: CaptureOn.MOUSE_MOVE,
|
|
432
|
+
...initialValues,
|
|
433
|
+
cursorStyles: initialValues.cursorStyles ? {
|
|
434
|
+
...initialValues.cursorStyles
|
|
435
|
+
} : {
|
|
436
|
+
default: 'default',
|
|
437
|
+
hover: 'pointer'
|
|
438
|
+
}
|
|
439
|
+
};
|
|
425
440
|
};
|
|
426
441
|
|
|
427
442
|
// ----------------------------------------------------------------------------
|
|
428
443
|
|
|
429
444
|
function extend(publicAPI, model) {
|
|
430
445
|
let initialValues = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
431
|
-
Object.assign(model,
|
|
446
|
+
Object.assign(model, defaultValues(initialValues));
|
|
432
447
|
macro.obj(publicAPI, model);
|
|
433
|
-
macro.setGet(publicAPI, model, ['captureOn', {
|
|
448
|
+
macro.setGet(publicAPI, model, ['captureOn', 'cursorStyles', {
|
|
434
449
|
type: 'enum',
|
|
435
450
|
name: 'viewType',
|
|
436
451
|
enum: ViewTypes
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -56,7 +56,7 @@ declare type Matrix3x3 = [
|
|
|
56
56
|
number
|
|
57
57
|
];
|
|
58
58
|
/**
|
|
59
|
-
* @deprecated The `Point` type is
|
|
59
|
+
* @deprecated The `Point` type is deprecated, please use `Vector3` instead.
|
|
60
60
|
*/
|
|
61
61
|
declare type Point = Vector3;
|
|
62
62
|
declare type HSLColor = [number, number, number];
|