@kitware/vtk.js 24.18.7 → 24.18.8
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.
|
@@ -3,7 +3,7 @@ import macro from '../../../macros.js';
|
|
|
3
3
|
import vtkBoundingBox from '../../../Common/DataModel/BoundingBox.js';
|
|
4
4
|
import vtkLine from '../../../Common/DataModel/Line.js';
|
|
5
5
|
import vtkPlanePointManipulator from '../../Manipulators/PlaneManipulator.js';
|
|
6
|
-
import {
|
|
6
|
+
import { s as subtract, l as normalize, d as dot, j as cross, m as multiplyAccumulate, x as multiplyScalar, S as signedAngleBetweenVectors } from '../../../Common/Core/Math/index.js';
|
|
7
7
|
import { updateState, getAssociatedLinesName, boundPointOnPlane, rotateVector } from './helpers.js';
|
|
8
8
|
import { InteractionMethodsName, ScrollingMethods } from './Constants.js';
|
|
9
9
|
|
|
@@ -83,7 +83,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
83
83
|
if (isScrolling) {
|
|
84
84
|
if (model.previousPosition.y !== callData.position.y) {
|
|
85
85
|
var step = model.previousPosition.y - callData.position.y;
|
|
86
|
-
publicAPI.
|
|
86
|
+
publicAPI.translateCenterOnPlaneDirection(step);
|
|
87
87
|
model.previousPosition = callData.position;
|
|
88
88
|
publicAPI.invokeInternalInteractionEvent();
|
|
89
89
|
}
|
|
@@ -121,7 +121,7 @@ function widgetBehavior(publicAPI, model) {
|
|
|
121
121
|
publicAPI.handleMouseWheel = function (calldata) {
|
|
122
122
|
var step = calldata.spinY;
|
|
123
123
|
isScrolling = true;
|
|
124
|
-
publicAPI.
|
|
124
|
+
publicAPI.translateCenterOnPlaneDirection(step);
|
|
125
125
|
publicAPI.invokeInternalInteractionEvent();
|
|
126
126
|
isScrolling = false;
|
|
127
127
|
return macro.EVENT_ABORT;
|
|
@@ -178,10 +178,8 @@ function widgetBehavior(publicAPI, model) {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
-
publicAPI.
|
|
182
|
-
var dirProj =
|
|
183
|
-
|
|
184
|
-
var direction = multiplyScalar(dirProj, -1);
|
|
181
|
+
publicAPI.translateCenterOnPlaneDirection = function (nbSteps) {
|
|
182
|
+
var dirProj = model.widgetState.getPlanes()[model.viewType].normal;
|
|
185
183
|
var oldCenter = model.widgetState.getCenter();
|
|
186
184
|
var image = model.widgetState.getImage();
|
|
187
185
|
var imageSpacing = image.getSpacing(); // Use Chebyshev norm
|
|
@@ -191,9 +189,9 @@ function widgetBehavior(publicAPI, model) {
|
|
|
191
189
|
return Math.abs(value);
|
|
192
190
|
});
|
|
193
191
|
var index = absDirProj.indexOf(Math.max.apply(Math, _toConsumableArray(absDirProj)));
|
|
194
|
-
var movingFactor = nbSteps *
|
|
192
|
+
var movingFactor = nbSteps * imageSpacing[index] / Math.abs(dirProj[index]); // Define the potentially new center
|
|
195
193
|
|
|
196
|
-
var newCenter = [oldCenter[0] + movingFactor *
|
|
194
|
+
var newCenter = [oldCenter[0] + movingFactor * dirProj[0], oldCenter[1] + movingFactor * dirProj[1], oldCenter[2] + movingFactor * dirProj[2]];
|
|
197
195
|
newCenter = publicAPI.getBoundedCenter(newCenter);
|
|
198
196
|
model.widgetState.setCenter(newCenter);
|
|
199
197
|
updateState(model.widgetState);
|