@kitware/vtk.js 26.0.0 → 26.1.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.
@@ -254,9 +254,8 @@ function vtkMouseRangeManipulator(publicAPI, model) {
254
254
  processDelta(model.scrollListener, delta * model.scrollListener.step);
255
255
  };
256
256
 
257
- publicAPI.onStartScroll = function (payload) {
257
+ publicAPI.onStartScroll = function () {
258
258
  model.interactionNetDelta = 0;
259
- publicAPI.onScroll(payload);
260
259
  };
261
260
  } // ----------------------------------------------------------------------------
262
261
  // Object factory
@@ -87,9 +87,8 @@ function vtkInteractorStyleImage(publicAPI, model) {
87
87
  }; //--------------------------------------------------------------------------
88
88
 
89
89
 
90
- publicAPI.handleStartMouseWheel = function (callData) {
90
+ publicAPI.handleStartMouseWheel = function () {
91
91
  publicAPI.startSlice();
92
- publicAPI.handleMouseWheel(callData);
93
92
  }; //--------------------------------------------------------------------------
94
93
 
95
94
 
@@ -128,9 +128,8 @@ function vtkInteractorStyleTrackballCamera(publicAPI, model) {
128
128
  }; //----------------------------------------------------------------------------
129
129
 
130
130
 
131
- publicAPI.handleStartMouseWheel = function (callData) {
131
+ publicAPI.handleStartMouseWheel = function () {
132
132
  publicAPI.startDolly();
133
- publicAPI.handleMouseWheel(callData);
134
133
  }; //--------------------------------------------------------------------------
135
134
 
136
135
 
@@ -698,6 +698,13 @@ function vtkCubeAxesActor(publicAPI, model) {
698
698
  vtkBoundingBox.setBounds(model.bounds, model.gridActor.getBounds());
699
699
  vtkBoundingBox.scaleAboutCenter(model.bounds, model.boundsScaleFactor, model.boundsScaleFactor, model.boundsScaleFactor);
700
700
  return model.bounds;
701
+ }; // Make sure the grid share the actor property
702
+
703
+
704
+ var _setProp = macro.chain(publicAPI.setProperty, model.gridActor.setProperty);
705
+
706
+ publicAPI.setProperty = function (p) {
707
+ return _setProp(p)[0];
701
708
  };
702
709
  } // ----------------------------------------------------------------------------
703
710
  // Object factory
@@ -626,6 +626,7 @@ function vtkRenderWindowInteractor(publicAPI, model) {
626
626
 
627
627
  if (model.wheelTimeoutID === 0) {
628
628
  publicAPI.startMouseWheelEvent(callData);
629
+ publicAPI.mouseWheelEvent(callData);
629
630
  } else {
630
631
  publicAPI.mouseWheelEvent(callData);
631
632
  clearTimeout(model.wheelTimeoutID);
@@ -1044,6 +1045,10 @@ function vtkRenderWindowInteractor(publicAPI, model) {
1044
1045
  document.removeEventListener('visibilitychange', publicAPI.handleVisibilityChange);
1045
1046
  }
1046
1047
 
1048
+ if (model.container) {
1049
+ publicAPI.unbindEvents();
1050
+ }
1051
+
1047
1052
  superDelete();
1048
1053
  }; // Use the Page Visibility API to detect when we switch away from or back to
1049
1054
  // this tab, and reset the animationFrameStart. When tabs are not active, browsers
@@ -707,10 +707,9 @@ function alwaysUpdateCamera() {
707
707
  setDefaultMapping();
708
708
  applyDefaultAliases(); // ----------------------------------------------------------------------------
709
709
  // Avoid handling any lights at the moment
710
+ // => vtk seems fine and PV could be fine as well but not tested so keeping PV exclude
710
711
 
711
- EXCLUDE_INSTANCE_MAP.vtkOpenGLLight = {};
712
- EXCLUDE_INSTANCE_MAP.vtkPVLight = {};
713
- EXCLUDE_INSTANCE_MAP.vtkLight = {}; // ----------------------------------------------------------------------------
712
+ EXCLUDE_INSTANCE_MAP.vtkPVLight = {}; // ----------------------------------------------------------------------------
714
713
  // Publicly exposed methods
715
714
  // ----------------------------------------------------------------------------
716
715
 
@@ -78,10 +78,15 @@ function pushMonitorGLContextCount(cb) {
78
78
  }
79
79
  function popMonitorGLContextCount(cb) {
80
80
  return GL_CONTEXT_LISTENERS.pop();
81
+ }
82
+
83
+ function _preventDefault(e) {
84
+ e.preventDefault();
81
85
  } // ----------------------------------------------------------------------------
82
86
  // vtkOpenGLRenderWindow methods
83
87
  // ----------------------------------------------------------------------------
84
88
 
89
+
85
90
  function vtkOpenGLRenderWindow(publicAPI, model) {
86
91
  // Set our className
87
92
  model.classHierarchy.push('vtkOpenGLRenderWindow');
@@ -92,9 +97,7 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
92
97
  }; // prevent default context lost handler
93
98
 
94
99
 
95
- model.canvas.addEventListener('webglcontextlost', function (event) {
96
- event.preventDefault();
97
- }, false);
100
+ model.canvas.addEventListener('webglcontextlost', _preventDefault, false);
98
101
  model.canvas.addEventListener('webglcontextrestored', publicAPI.restoreContext, false); // Cache the value here as calling it on each frame is expensive
99
102
 
100
103
  var isImmersiveVrSupported = navigator.xr !== undefined && navigator.xr.isSessionSupported('immersive-vr'); // Auto update style
@@ -886,7 +889,12 @@ function vtkOpenGLRenderWindow(publicAPI, model) {
886
889
  return ret;
887
890
  };
888
891
 
889
- publicAPI.delete = macro.chain(publicAPI.delete, publicAPI.setViewStream, deleteGLContext);
892
+ function clearEvents() {
893
+ model.canvas.removeEventListener('webglcontextlost', _preventDefault);
894
+ model.canvas.removeEventListener('webglcontextrestored', publicAPI.restoreContext);
895
+ }
896
+
897
+ publicAPI.delete = macro.chain(clearEvents, publicAPI.delete, publicAPI.setViewStream, deleteGLContext);
890
898
  } // ----------------------------------------------------------------------------
891
899
  // Object factory
892
900
  // ----------------------------------------------------------------------------
@@ -5,7 +5,7 @@ import { vec3 } from 'gl-matrix';
5
5
  function widgetBehavior(publicAPI, model) {
6
6
  model.painting = model._factory.getPainting();
7
7
 
8
- publicAPI.handleLeftButtonPress = function (callData) {
8
+ publicAPI.handleLeftButtonPress = function () {
9
9
  if (!model.activeState || !model.activeState.getActive()) {
10
10
  return macro.VOID;
11
11
  }
@@ -169,13 +169,13 @@ function widgetBehavior(publicAPI, model) {
169
169
  }
170
170
  };
171
171
 
172
- publicAPI.handleRightButtonRelease = function (calldata) {
172
+ publicAPI.handleRightButtonRelease = function () {
173
173
  if (model.widgetState.getScrollingMethod() === ScrollingMethods.RIGHT_MOUSE_BUTTON) {
174
174
  publicAPI.endScrolling();
175
175
  }
176
176
  };
177
177
 
178
- publicAPI.handleStartMouseWheel = function (callData) {
178
+ publicAPI.handleStartMouseWheel = function () {
179
179
  publicAPI.resetUpdateMethod();
180
180
  publicAPI.startInteraction();
181
181
  };
@@ -189,7 +189,7 @@ function widgetBehavior(publicAPI, model) {
189
189
  return macro.EVENT_ABORT;
190
190
  };
191
191
 
192
- publicAPI.handleEndMouseWheel = function (calldata) {
192
+ publicAPI.handleEndMouseWheel = function () {
193
193
  publicAPI.endScrolling();
194
194
  };
195
195
 
@@ -199,7 +199,7 @@ function widgetBehavior(publicAPI, model) {
199
199
  }
200
200
  };
201
201
 
202
- publicAPI.handleMiddleButtonRelease = function (calldata) {
202
+ publicAPI.handleMiddleButtonRelease = function () {
203
203
  if (model.widgetState.getScrollingMethod() === ScrollingMethods.MIDDLE_MOUSE_BUTTON) {
204
204
  publicAPI.endScrolling();
205
205
  }
package/macros.d.ts CHANGED
@@ -290,7 +290,7 @@ export interface VtkChangeEvent {
290
290
  * @param VtkCallback
291
291
  * @param priority (default 0.0)
292
292
  */
293
- onChange(VtkCallback, priority?: number): vtkSubscription;
293
+ onChange(VtkCallback: (...args: any) => void | symbol, priority?: number): vtkSubscription;
294
294
  }
295
295
 
296
296
  // ----------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "26.0.0",
3
+ "version": "26.1.0",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",