@cornerstonejs/core 2.14.4 → 2.14.6
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.
|
@@ -379,8 +379,8 @@ class Viewport {
|
|
|
379
379
|
const dimensions = imageData.getDimensions();
|
|
380
380
|
const canvasZero = this.worldToCanvas(imageData.indexToWorld([0, 0, 0]));
|
|
381
381
|
const canvasEdge = this.worldToCanvas(imageData.indexToWorld([
|
|
382
|
-
dimensions[0]
|
|
383
|
-
dimensions[1]
|
|
382
|
+
dimensions[0],
|
|
383
|
+
dimensions[1],
|
|
384
384
|
dimensions[2],
|
|
385
385
|
]));
|
|
386
386
|
const canvasImage = [
|
|
@@ -388,28 +388,33 @@ class Viewport {
|
|
|
388
388
|
Math.abs(canvasEdge[1] - canvasZero[1]),
|
|
389
389
|
];
|
|
390
390
|
const [imgWidth, imgHeight] = canvasImage;
|
|
391
|
+
let zoom = this.getZoom() / this.insetImageMultiplier;
|
|
391
392
|
if (imageArea) {
|
|
392
393
|
const [areaX, areaY] = imageArea;
|
|
394
|
+
const currentScale = Math.max(Math.abs(imgWidth / canvasWidth), Math.abs(imgHeight / canvasHeight));
|
|
393
395
|
const requireX = Math.abs((areaX * imgWidth) / canvasWidth);
|
|
394
396
|
const requireY = Math.abs((areaY * imgHeight) / canvasHeight);
|
|
395
397
|
const initZoom = this.getZoom();
|
|
396
398
|
const fitZoom = this.getZoom(this.fitToCanvasCamera);
|
|
397
|
-
const absZoom =
|
|
399
|
+
const absZoom = requireX > requireY ? currentScale / requireX : currentScale / requireY;
|
|
398
400
|
const applyZoom = (absZoom * initZoom) / fitZoom;
|
|
399
|
-
|
|
401
|
+
zoom = applyZoom;
|
|
402
|
+
this.setZoom(this.insetImageMultiplier * zoom, false);
|
|
400
403
|
}
|
|
401
404
|
if (imageCanvasPoint) {
|
|
405
|
+
console.log('Starting pan update zoom=', zoom);
|
|
402
406
|
const { imagePoint, canvasPoint = imagePoint || [0.5, 0.5] } = imageCanvasPoint;
|
|
403
407
|
const [canvasX, canvasY] = canvasPoint;
|
|
404
408
|
const canvasPanX = canvasWidth * (canvasX - 0.5);
|
|
405
409
|
const canvasPanY = canvasHeight * (canvasY - 0.5);
|
|
406
410
|
const [imageX, imageY] = imagePoint || canvasPoint;
|
|
407
|
-
const useZoom =
|
|
408
|
-
const imagePanX = useZoom * imgWidth * (0.5 - imageX);
|
|
409
|
-
const imagePanY = useZoom * imgHeight * (0.5 - imageY);
|
|
411
|
+
const useZoom = zoom;
|
|
412
|
+
const imagePanX = this.insetImageMultiplier * useZoom * imgWidth * (0.5 - imageX);
|
|
413
|
+
const imagePanY = this.insetImageMultiplier * useZoom * imgHeight * (0.5 - imageY);
|
|
410
414
|
const newPositionX = imagePanX + canvasPanX;
|
|
411
415
|
const newPositionY = imagePanY + canvasPanY;
|
|
412
416
|
const deltaPoint2 = [newPositionX, newPositionY];
|
|
417
|
+
console.log('delta point', newPositionX, this.getPan()[0], imagePanX, canvasPanX);
|
|
413
418
|
vec2.add(deltaPoint2, deltaPoint2, this.getPan());
|
|
414
419
|
this.setPan(deltaPoint2, false);
|
|
415
420
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.6",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"type": "individual",
|
|
83
83
|
"url": "https://ohif.org/donate"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "72f72a5a2b2c7754ec8605232eca8517b72ca365"
|
|
86
86
|
}
|