@kitware/vtk.js 26.0.0-beta.3 → 26.0.0-beta.4

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.
@@ -1,3 +1,10 @@
1
+ ## From 25.x to 26
2
+
3
+ - **ResliceCursorWidget**: vtkResliceCursorContextRepresentation is deprecated and removed.
4
+ Instead, a `vtkSphereHandleRepresentation` is used for `rotation` and `center` handles,
5
+ and a `vtkLineHandleRepresenttion` is used for the axes. `rotateLineInView()` now
6
+ takes an axis name (string, e.g. 'XinY') instead of a substate.
7
+
1
8
  ## From 24.x to 25
2
9
 
3
10
  - **math**: For functions calling math functions for computations with matrices, the format must now be number[] or Matrix as defined in the typescript definitions.
@@ -9,7 +9,8 @@ import { InteractionMethodsName, lineNames, ScrollingMethods, planeNameToViewTyp
9
9
 
10
10
  function widgetBehavior(publicAPI, model) {
11
11
  model._isDragging = false;
12
- var isScrolling = false; // FIXME: label information should be accessible from activeState instead of parent state.
12
+ var isScrolling = false;
13
+ var previousPosition; // FIXME: label information should be accessible from activeState instead of parent state.
13
14
 
14
15
  publicAPI.getActiveInteraction = function () {
15
16
  if (model.widgetState.getStatesWithLabel('rotation').includes(model.activeState)) {
@@ -80,7 +81,7 @@ function widgetBehavior(publicAPI, model) {
80
81
 
81
82
  publicAPI.startScrolling = function (newPosition) {
82
83
  if (newPosition) {
83
- model.previousPosition = newPosition;
84
+ previousPosition = newPosition;
84
85
  }
85
86
 
86
87
  isScrolling = true;
@@ -124,6 +125,8 @@ function widgetBehavior(publicAPI, model) {
124
125
  var currentPlaneNormal = model.widgetState.getPlanes()[viewType].normal;
125
126
  model.planeManipulator.setWidgetOrigin(model.widgetState.getCenter());
126
127
  model.planeManipulator.setWidgetNormal(currentPlaneNormal);
128
+ var worldCoords = model.planeManipulator.handleEvent(callData, model._apiSpecificRenderWindow);
129
+ previousPosition = worldCoords;
127
130
  publicAPI.startInteraction();
128
131
  } else if (model.widgetState.getScrollingMethod() === ScrollingMethods.LEFT_MOUSE_BUTTON) {
129
132
  publicAPI.startScrolling(callData.position);
@@ -140,10 +143,10 @@ function widgetBehavior(publicAPI, model) {
140
143
  }
141
144
 
142
145
  if (isScrolling) {
143
- if (model.previousPosition.y !== callData.position.y) {
144
- var step = model.previousPosition.y - callData.position.y;
146
+ if (previousPosition.y !== callData.position.y) {
147
+ var step = previousPosition.y - callData.position.y;
145
148
  publicAPI.translateCenterOnPlaneDirection(step);
146
- model.previousPosition = callData.position;
149
+ previousPosition = callData.position;
147
150
  publicAPI.invokeInternalInteractionEvent();
148
151
  }
149
152
  }
@@ -298,8 +301,11 @@ function widgetBehavior(publicAPI, model) {
298
301
 
299
302
  publicAPI[InteractionMethodsName.TranslateCenter] = function (calldata) {
300
303
  var worldCoords = model.planeManipulator.handleEvent(calldata, model._apiSpecificRenderWindow);
301
- worldCoords = publicAPI.getBoundedCenter(worldCoords);
302
- model.widgetState.setCenter(worldCoords);
304
+ var translation = subtract(worldCoords, previousPosition, []);
305
+ previousPosition = worldCoords;
306
+ var newCenter = add(model.widgetState.getCenter(), translation, []);
307
+ newCenter = publicAPI.getBoundedCenter(newCenter);
308
+ model.widgetState.setCenter(newCenter);
303
309
  updateState(model.widgetState, model._factory.getDisplayScaleParams(), model._factory.getRotationHandlePosition());
304
310
  };
305
311
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kitware/vtk.js",
3
- "version": "26.0.0-beta.3",
3
+ "version": "26.0.0-beta.4",
4
4
  "description": "Visualization Toolkit for the Web",
5
5
  "keywords": [
6
6
  "3d",