@cornerstonejs/tools 0.63.3 → 0.64.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.
- package/dist/cjs/tools/ZoomTool.js +6 -3
- package/dist/cjs/tools/ZoomTool.js.map +1 -1
- package/dist/esm/tools/ZoomTool.js +6 -3
- package/dist/esm/tools/ZoomTool.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +2 -2
- package/src/tools/ZoomTool.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.64.0",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "dist/umd/index.js",
|
|
6
6
|
"types": "dist/esm/index.d.ts",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"type": "individual",
|
|
53
53
|
"url": "https://ohif.org/donate"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e632cdd1b824e9e65a6af1af69797a446629378f"
|
|
56
56
|
}
|
package/src/tools/ZoomTool.ts
CHANGED
|
@@ -16,7 +16,6 @@ class ZoomTool extends BaseTool {
|
|
|
16
16
|
initialMousePosWorld: Types.Point3;
|
|
17
17
|
dirVec: Types.Point3;
|
|
18
18
|
|
|
19
|
-
// Apparently TS says super _must_ be the first call? This seems a bit opinionated.
|
|
20
19
|
constructor(
|
|
21
20
|
toolProps: PublicToolProps = {},
|
|
22
21
|
defaultToolProps: ToolProps = {
|
|
@@ -28,6 +27,7 @@ class ZoomTool extends BaseTool {
|
|
|
28
27
|
maxZoomScale: 30,
|
|
29
28
|
pinchToZoom: true,
|
|
30
29
|
pan: true,
|
|
30
|
+
invert: false,
|
|
31
31
|
},
|
|
32
32
|
}
|
|
33
33
|
) {
|
|
@@ -146,7 +146,7 @@ class ZoomTool extends BaseTool {
|
|
|
146
146
|
const { parallelScale, focalPoint, position } = camera;
|
|
147
147
|
|
|
148
148
|
const zoomScale = 1.5 / size[1];
|
|
149
|
-
const k = deltaY * zoomScale;
|
|
149
|
+
const k = deltaY * zoomScale * (this.configuration.invert ? -1 : 1);
|
|
150
150
|
|
|
151
151
|
let parallelScaleToSet = (1.0 - k) * parallelScale;
|
|
152
152
|
|
|
@@ -169,7 +169,7 @@ class ZoomTool extends BaseTool {
|
|
|
169
169
|
// and the initial mouse position by some amount until ultimately we
|
|
170
170
|
// reach the mouse position at the focal point
|
|
171
171
|
const zoomScale = 5 / size[1];
|
|
172
|
-
const k = deltaY * zoomScale;
|
|
172
|
+
const k = deltaY * zoomScale * (this.configuration.invert ? -1 : 1);
|
|
173
173
|
parallelScaleToSet = (1.0 - k) * parallelScale;
|
|
174
174
|
|
|
175
175
|
positionToSet = vec3.scaleAndAdd(
|
|
@@ -244,7 +244,9 @@ class ZoomTool extends BaseTool {
|
|
|
244
244
|
-viewPlaneNormal[2],
|
|
245
245
|
];
|
|
246
246
|
|
|
247
|
-
const k =
|
|
247
|
+
const k = this.configuration.invert
|
|
248
|
+
? deltaY / zoomScale
|
|
249
|
+
: deltaY * zoomScale;
|
|
248
250
|
|
|
249
251
|
let tmp = k * directionOfProjection[0];
|
|
250
252
|
position[0] += tmp;
|