@kitware/vtk.js 24.14.1 → 24.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,10 +25,19 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
25
25
  var resizeObserver = new ResizeObserver(function (entries) {
26
26
  publicAPI.updateViewport();
27
27
  });
28
+ var onCameraChangedSub = null;
29
+ var onCameraModifiedSub = null;
28
30
  var onAnimationSub = null;
29
31
  var onEndAnimationSub = null;
30
32
  var selfSubscription = null;
31
33
 
34
+ function onCameraModified() {
35
+ // If animating, marker will be updated on Animation event
36
+ if (!model._interactor.isAnimating()) {
37
+ publicAPI.updateMarkerOrientation();
38
+ }
39
+ }
40
+
32
41
  publicAPI.computeViewport = function () {
33
42
  var parentRen = model.parentRenderer || model._interactor.getCurrentRenderer();
34
43
 
@@ -147,6 +156,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
147
156
  selfRenderer.setInteractive(false);
148
157
  selfRenderer.addViewProp(model.actor);
149
158
  model.actor.setVisibility(true);
159
+ onCameraChangedSub = ren.onEvent(function (event) {
160
+ if (event.type === 'ActiveCameraEvent') {
161
+ if (onCameraModifiedSub) {
162
+ onCameraModifiedSub.unsubscribe();
163
+ }
164
+
165
+ onCameraModifiedSub = event.camera.onModified(onCameraModified);
166
+ }
167
+ });
168
+ onCameraModifiedSub = ren.getActiveCamera().onModified(onCameraModified);
150
169
  onAnimationSub = model._interactor.onAnimation(publicAPI.updateMarkerOrientation);
151
170
  onEndAnimationSub = model._interactor.onEndAnimation(publicAPI.updateMarkerOrientation);
152
171
  resizeObserver.observe(model._interactor.getView().getCanvas());
@@ -160,6 +179,10 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
160
179
 
161
180
  model.enabled = false;
162
181
  resizeObserver.disconnect();
182
+ onCameraChangedSub.unsubscribe();
183
+ onCameraChangedSub = null;
184
+ onCameraModifiedSub.unsubscribe();
185
+ onCameraModifiedSub = null;
163
186
  onAnimationSub.unsubscribe();
164
187
  onAnimationSub = null;
165
188
  onEndAnimationSub.unsubscribe();
@@ -234,6 +257,16 @@ function vtkOrientationMarkerWidget(publicAPI, model) {
234
257
  selfSubscription = null;
235
258
  }
236
259
 
260
+ if (onCameraChangedSub) {
261
+ onCameraChangedSub.unsubscribe();
262
+ onCameraChangedSub = null;
263
+ }
264
+
265
+ if (onCameraModifiedSub) {
266
+ onCameraModifiedSub.unsubscribe();
267
+ onCameraModifiedSub = null;
268
+ }
269
+
237
270
  if (onAnimationSub) {
238
271
  onAnimationSub.unsubscribe();
239
272
  onAnimationSub = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "24.14.1",
3
+ "version": "24.14.2",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",