@kitware/vtk.js 21.1.1 → 21.1.5

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.
@@ -8,6 +8,10 @@ In ShapeWidget:
8
8
 
9
9
  RectangleWidget and EllipseWidget handles now scale up automatically.
10
10
 
11
+ ## From 19.2 to 19.3
12
+
13
+ Node >=12 is required
14
+
11
15
  ## From 18.x to 19
12
16
 
13
17
  vtkWidgetRepresentation.updateActorVisibility(...) lost the widgetVisibility parameter.
@@ -698,11 +698,6 @@ function vtkTubeFilter(publicAPI, model) {
698
698
  numberOfComponents: 3
699
699
  });
700
700
  var numNormals = 3 * numNewPts;
701
-
702
- if (model.capping) {
703
- numNormals = 3 * (numNewPts + 2 * model.numberOfSides);
704
- }
705
-
706
701
  var newNormalsData = new Float32Array(numNormals);
707
702
  var newNormals = vtkDataArray.newInstance({
708
703
  numberOfComponents: 3,
@@ -0,0 +1,25 @@
1
+ import { Size, Vector3 } from '@kitware/vtk.js/types';
2
+
3
+ declare function createMethods(session: any): {
4
+ subscribeToImageStream: (callback: any) => any;
5
+ unsubscribeToImageStream: (subscription: any) => any;
6
+ registerView: (viewId: number) => any;
7
+ unregisterView: (viewId: number) => any;
8
+ enableView: (viewId: number, enabled: boolean) => any;
9
+ render: (options?: {
10
+ size: Size;
11
+ view: number;
12
+ }) => any;
13
+ resetCamera: (view?: number) => any;
14
+ invalidateCache: (viewId: number) => any;
15
+ setQuality: (viewId: number, quality: number, ratio?: number) => any;
16
+ setSize: (viewId: number, width?: number, height?: number) => any;
17
+ setServerAnimationFPS: (fps?: number) => any;
18
+ getServerAnimationFPS: () => number;
19
+ startAnimation: (viewId?: number) => any;
20
+ stopAnimation: (viewId?: number) => any;
21
+ updateCamera: (viewId: number, focalPoint: Vector3, viewUp: Vector3, position: Vector3, forceUpdate?: boolean) => any;
22
+ updateCameraParameters: (viewId?: number, parameters?: {}, forceUpdate?: boolean) => any;
23
+ }
24
+
25
+ export default createMethods;
@@ -0,0 +1,256 @@
1
+ import { vtkObject } from '@kitware/vtk.js/interfaces';
2
+ import { Size } from '@kitware/vtk.js/types';
3
+ import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera';
4
+ import DefaultProtocol from '@kitware/vtk.js/IO/Core/ImageStream/DefaultProtocol';
5
+ /**
6
+ *
7
+ */
8
+ export interface IViewStreamInitialValues {
9
+ protocol?: typeof DefaultProtocol;
10
+ api?: any;
11
+ cameraUpdateRate?: number;
12
+ decodeImage?: boolean;
13
+ fpsWindowSize?: number;
14
+ interactiveQuality?: number;
15
+ interactiveRatio?: number;
16
+ isAnimating?: boolean;
17
+ mimeType?: string;
18
+ size?: Size;
19
+ stillQuality?: number;
20
+ stillRatio?: number;
21
+ useCameraParameters?: boolean;
22
+ viewId?: string;
23
+ }
24
+
25
+ interface IMetaData {
26
+ size: Size,
27
+ id: string,
28
+ memory: number,
29
+ workTime: number,
30
+ }
31
+
32
+ interface IEvent {
33
+ url: string,
34
+ fps: number[],
35
+ metadata: IMetaData,
36
+ }
37
+
38
+ export interface vtkViewStream extends vtkObject {
39
+ /**
40
+ *
41
+ * @param callback
42
+ */
43
+ onImageReady(callback: () => void): any;
44
+
45
+ /**
46
+ *
47
+ */
48
+ getViewId(): string;
49
+
50
+ /**
51
+ *
52
+ */
53
+ getSize(): Size;
54
+
55
+ /**
56
+ *
57
+ */
58
+ getFps(): number[];
59
+
60
+ /**
61
+ *
62
+ */
63
+ getLastImageEvent(): IEvent;
64
+
65
+ /**
66
+ *
67
+ */
68
+ getCamera(): vtkCamera;
69
+
70
+ /**
71
+ *
72
+ * @param camera
73
+ */
74
+ setCamera(camera: vtkCamera): boolean;
75
+
76
+ /**
77
+ *
78
+ */
79
+ getCameraUpdateRate(): number;
80
+
81
+ /**
82
+ *
83
+ * @param cameraUpdateRate
84
+ */
85
+ setCameraUpdateRate(cameraUpdateRate: number): boolean;
86
+
87
+ /**
88
+ *
89
+ */
90
+ getDecodeImage(): boolean;
91
+
92
+ /**
93
+ *
94
+ * @param decodeImage
95
+ */
96
+ setDecodeImage(decodeImage: boolean): boolean;
97
+
98
+ /**
99
+ *
100
+ */
101
+ getFpsWindowSize(): number;
102
+
103
+ /**
104
+ *
105
+ * @param fpsWindowSize
106
+ */
107
+ setFpsWindowSize(fpsWindowSize: number): boolean;
108
+
109
+ /**
110
+ *
111
+ */
112
+ getInteractiveQuality(): number;
113
+
114
+ /**
115
+ *
116
+ * @param interactiveQuality
117
+ */
118
+ setInteractiveQuality(interactiveQuality: number): boolean;
119
+
120
+ /**
121
+ *
122
+ */
123
+ getInteractiveRatio(): number;
124
+
125
+ /**
126
+ *
127
+ * @param interactiveRatio
128
+ */
129
+ setInteractiveRatio(interactiveRatio: number): boolean;
130
+
131
+ /**
132
+ *
133
+ */
134
+ getStillQuality(): number;
135
+
136
+ /**
137
+ *
138
+ * @param stillQuality
139
+ */
140
+ setStillQuality(stillQuality: number): boolean;
141
+
142
+ /**
143
+ *
144
+ */
145
+ getStillRatio(): number;
146
+
147
+ /**
148
+ *
149
+ * @param stillRatio
150
+ */
151
+ setStillRatio(stillRatio: number): boolean;
152
+
153
+ /**
154
+ *
155
+ */
156
+ getUseCameraParameters(): boolean;
157
+
158
+ /**
159
+ *
160
+ * @param useCameraParameters
161
+ */
162
+ setUseCameraParameters(useCameraParameters: boolean): boolean;
163
+
164
+ /**
165
+ *
166
+ */
167
+ pushCamera(): any;
168
+
169
+ /**
170
+ *
171
+ */
172
+ invalidateCache(): any;
173
+
174
+ /**
175
+ *
176
+ */
177
+ render(): any;
178
+
179
+ /**
180
+ *
181
+ */
182
+ resetCamera(): any;
183
+
184
+ /**
185
+ *
186
+ */
187
+ startAnimation(): any;
188
+
189
+ /**
190
+ *
191
+ */
192
+ stopAnimation(): any;
193
+
194
+ /**
195
+ *
196
+ * @param width
197
+ * @param height
198
+ */
199
+ setSize(width: number, height: number): any;
200
+
201
+ /**
202
+ *
203
+ */
204
+ startInteraction(): any;
205
+
206
+ /**
207
+ *
208
+ */
209
+ endInteraction(): any;
210
+
211
+ /**
212
+ *
213
+ * @param viewId
214
+ */
215
+ setViewId(viewId: string): boolean;
216
+
217
+ /**
218
+ *
219
+ * @param msg
220
+ */
221
+ processMessage(msg: any): void;
222
+
223
+ /**
224
+ *
225
+ */
226
+ delete(): void;
227
+ }
228
+
229
+ /**
230
+ * Method used to decorate a given object (publicAPI+model) with vtkViewStream characteristics.
231
+ * @param publicAPI
232
+ * @param model
233
+ * @param initialValues
234
+ */
235
+ export function extend(
236
+ publicAPI: object,
237
+ model: object,
238
+ initialValues?: IViewStreamInitialValues
239
+ ): void;
240
+
241
+ /**
242
+ * Method used to create a new instance of vtkViewStream
243
+ * @param {IViewStreamInitialValues} [initialValues] for pre-setting some of its content
244
+ */
245
+ export function newInstance(
246
+ initialValues?: IViewStreamInitialValues
247
+ ): vtkViewStream;
248
+
249
+ /**
250
+ * IViewStreamInitialValues provides a way to create a remote view.
251
+ */
252
+ export declare const vtkViewStream: {
253
+ newInstance: typeof newInstance;
254
+ extend: typeof extend;
255
+ };
256
+ export default vtkViewStream;
@@ -15,7 +15,6 @@ import { vtkObject, vtkSubscription } from '@kitware/vtk.js/interfaces';
15
15
  */
16
16
  export function setSmartConnectClass(smartConnectClass: object): void;
17
17
 
18
-
19
18
  export interface vtkWSLinkClient extends vtkObject {
20
19
 
21
20
  /**
@@ -117,21 +116,45 @@ export interface vtkWSLinkClient extends vtkObject {
117
116
  */
118
117
  getConfigDecorator(): (config: object) => object;
119
118
 
120
- getConnection(): object;
121
- getCongig(): object;
119
+ /**
120
+ *
121
+ */
122
+ getConnection(): any;
123
+
124
+ /**
125
+ *
126
+ */
127
+ getConfig(): object;
128
+
129
+ /**
130
+ *
131
+ */
122
132
  getRemote(): object;
133
+
134
+ /**
135
+ *
136
+ */
123
137
  getImageStream(): object;
124
138
 
139
+ /**
140
+ *
141
+ * @param callback
142
+ * @param priority
143
+ */
125
144
  onBusyChange(callback: Function, priority: number): vtkSubscription;
145
+
146
+ /**
147
+ *
148
+ */
126
149
  invokeBusyChange(): void;
127
150
 
128
- onConnectionReady(callback: () => void): vtkSubscription;
151
+ onConnectionReady(callback: (httpReq: any) => void): vtkSubscription;
129
152
  // invokeConnectionReady(): void
130
153
 
131
- onConnectionError(callback: () => void): vtkSubscription;
154
+ onConnectionError(callback: (httpReq: any) => void): vtkSubscription;
132
155
  // invokeConnectionError(): void
133
156
 
134
- onConnectionClose(callback: () => void): vtkSubscription;
157
+ onConnectionClose(callback: (httpReq: any) => void): vtkSubscription;
135
158
  // invokeConnectionClose(): void
136
159
  }
137
160
 
@@ -56,7 +56,9 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
56
56
 
57
57
  var _container$getBoundin = container.getBoundingClientRect(),
58
58
  width = _container$getBoundin.width,
59
- height = _container$getBoundin.height;
59
+ height = _container$getBoundin.height,
60
+ top = _container$getBoundin.top,
61
+ left = _container$getBoundin.left;
60
62
 
61
63
  var _getBounds = getBounds(),
62
64
  _getBounds2 = _slicedToArray(_getBounds, 4),
@@ -65,8 +67,10 @@ function vtkMouseBoxSelectionManipulator(publicAPI, model) {
65
67
  yMin = _getBounds2[2],
66
68
  yMax = _getBounds2[3];
67
69
 
68
- div.style.left = "".concat(width * xMin / viewWidth, "px");
69
- div.style.top = "".concat(height - height * yMax / viewHeight, "px");
70
+ var xShift = left + window.scrollX;
71
+ var yShift = top + window.scrollY;
72
+ div.style.left = "".concat(xShift + width * xMin / viewWidth, "px");
73
+ div.style.top = "".concat(yShift + height - height * yMax / viewHeight, "px");
70
74
  div.style.width = "".concat(width * (xMax - xMin) / viewWidth, "px");
71
75
  div.style.height = "".concat(height * (yMax - yMin) / viewHeight, "px");
72
76
  } //-------------------------------------------------------------------------
@@ -30,7 +30,7 @@ function vtkVRButtonPanManipulator(publicAPI, model) {
30
30
 
31
31
  var speed = data.gamepad.axes[1]; // 0.05 meters / frame movement
32
32
 
33
- var pscale = speed * 0.05 / camera.getPhysicalScale(); // convert orientation to world coordinate direction
33
+ var pscale = speed * 0.05 * camera.getPhysicalScale(); // convert orientation to world coordinate direction
34
34
 
35
35
  var dir = camera.physicalOrientationToWorldDirection(data.orientation);
36
36
  camera.setPhysicalTranslation(oldTrans[0] + dir[0] * pscale, oldTrans[1] + dir[1] * pscale, oldTrans[2] + dir[2] * pscale);
@@ -79,7 +79,7 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
79
79
 
80
80
  var speed = ed.gamepad.axes[1]; // 0.05 meters / frame movement
81
81
 
82
- var pscale = speed * 0.05 / camera.getPhysicalScale(); // convert orientation to world coordinate direction
82
+ var pscale = speed * 0.05 * camera.getPhysicalScale(); // convert orientation to world coordinate direction
83
83
 
84
84
  var dir = camera.physicalOrientationToWorldDirection(ed.orientation);
85
85
  camera.setPhysicalTranslation(oldTrans[0] + dir[0] * pscale, oldTrans[1] + dir[1] * pscale, oldTrans[2] + dir[2] * pscale);
@@ -0,0 +1,199 @@
1
+ import { vtkObject } from '@kitware/vtk.js/interfaces';
2
+ import vtkCanvasView from '@kitware/vtk.js/Rendering/Misc/CanvasView';
3
+ import vtkViewStream from '@kitware/vtk.js/IO/Core/ImageStream/ViewStream';
4
+
5
+ interface IRemoteViewInitialValues {
6
+ viewId?: string;
7
+ interactiveQuality?: number;
8
+ interactiveRatio?: number;
9
+ stillQuality?: number;
10
+ stillRatio?: number;
11
+ rpcMouseEvent?: string;
12
+ rpcGestureEvent?: any;
13
+ rpcWheelEvent?: any;
14
+ }
15
+
16
+ export interface vtkRemoteView extends vtkObject {
17
+ /**
18
+ * Get container element
19
+ */
20
+ getContainer(): HTMLElement;
21
+
22
+ /**
23
+ *
24
+ */
25
+ getViewStream(): vtkViewStream;
26
+
27
+ /**
28
+ *
29
+ */
30
+ getCanvasView(): vtkCanvasView;
31
+
32
+ /**
33
+ *
34
+ */
35
+ getInteractor(): any;
36
+
37
+ /**
38
+ *
39
+ */
40
+ getInteractorStyle(): any;
41
+
42
+ /**
43
+ *
44
+ */
45
+ getInteractiveQuality(): number;
46
+
47
+ /**
48
+ *
49
+ */
50
+ getInteractiveRatio(): number;
51
+
52
+ /**
53
+ *
54
+ */
55
+ getStillQuality(): number;
56
+
57
+ /**
58
+ *
59
+ */
60
+ getStillRatio(): number;
61
+
62
+ /**
63
+ *
64
+ */
65
+ getSession(): any;
66
+
67
+ /**
68
+ *
69
+ * @param session
70
+ */
71
+ setSession(session: any): boolean;
72
+
73
+ /**
74
+ *
75
+ */
76
+ getRpcMouseEvent(): string;
77
+
78
+ /**
79
+ *
80
+ * @param rpcMouseEvent
81
+ */
82
+ setRpcMouseEvent(rpcMouseEvent: string): boolean;
83
+
84
+ /**
85
+ *
86
+ */
87
+ getRpcGestureEvent(): any;
88
+
89
+ /**
90
+ *
91
+ * @param rpcGestureEvent
92
+ */
93
+ setRpcGestureEvent(rpcGestureEvent: any): boolean;
94
+
95
+ /**
96
+ *
97
+ */
98
+ getRpcWheelEvent(): any;
99
+
100
+ /**
101
+ *
102
+ * @param rpcWheelEvent
103
+ */
104
+ setRpcWheelEvent(rpcWheelEvent: any): boolean;
105
+
106
+ /**
107
+ * Release GL context
108
+ */
109
+ delete(): void;
110
+
111
+ /**
112
+ *
113
+ * @param viewStream
114
+ */
115
+ setViewStream(viewStream: vtkViewStream): boolean;
116
+
117
+ /**
118
+ *
119
+ * @param viewId
120
+ */
121
+ setViewId(viewId: string): void;
122
+
123
+ /**
124
+ *
125
+ * @param {HTMLElement} container The container HTML element.
126
+ */
127
+ setContainer(container: HTMLElement): boolean;
128
+
129
+ /**
130
+ * Handle window resize
131
+ */
132
+ resize(): void;
133
+
134
+ /**
135
+ *
136
+ */
137
+ render(): void;
138
+
139
+ /**
140
+ *
141
+ */
142
+ resetCamera(): void;
143
+
144
+ /**
145
+ *
146
+ * @param interactiveQuality
147
+ */
148
+ setInteractiveQuality(interactiveQuality: number): boolean;
149
+
150
+ /**
151
+ *
152
+ * @param interactiveRatio
153
+ */
154
+ setInteractiveRatio(interactiveRatio: number): boolean;
155
+
156
+ /**
157
+ *
158
+ * @param stillQuality
159
+ */
160
+ setStillQuality(stillQuality: number): boolean;
161
+
162
+ /**
163
+ *
164
+ * @param stillRatio
165
+ */
166
+ setStillRatio(stillRatio: number): boolean;
167
+ }
168
+
169
+ /**
170
+ * Method used to decorate a given object (publicAPI+model) with vtkRemoteView characteristics.
171
+ *
172
+ * @param publicAPI object on which methods will be bounds (public)
173
+ * @param model object on which data structure will be bounds (protected)
174
+ * @param {IRemoteViewInitialValues} [initialValues] (default: {})
175
+ */
176
+ export function extend(
177
+ publicAPI: object,
178
+ model: object,
179
+ initialValues?: IRemoteViewInitialValues
180
+ ): void;
181
+
182
+ /**
183
+ * Method used to create a new instance of vtkCanvasView
184
+ * @param {IRemoteViewInitialValues} [initialValues] for pre-setting some of its content
185
+ */
186
+ export function newInstance(
187
+ initialValues?: IRemoteViewInitialValues
188
+ ): vtkRemoteView;
189
+
190
+ export function connectImageStream(session: any): any;
191
+ /**
192
+ * vtkRemoteView provides a way to create a remote view.
193
+ */
194
+ export declare const vtkRemoteView: {
195
+ newInstance: typeof newInstance;
196
+ extend: typeof extend;
197
+ connectImageStream: typeof connectImageStream;
198
+ };
199
+ export default vtkRemoteView;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "21.1.1",
3
+ "version": "21.1.5",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",
@@ -131,7 +131,7 @@
131
131
  "xml2js": "0.4.23"
132
132
  },
133
133
  "peerDependencies": {
134
- "wslink": "1.0.7"
134
+ "wslink": "^1.1.0"
135
135
  },
136
136
  "scripts": {
137
137
  "validate": "prettier --config ./prettier.config.js --list-different \"Sources/**/*.js\" \"Examples/**/*.js\"",