@cornerstonejs/core 1.61.3 → 1.61.5
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/RenderingEngine/RenderingEngine.js +17 -1
- package/dist/cjs/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/cjs/RenderingEngine/Viewport.js +6 -6
- package/dist/cjs/RenderingEngine/Viewport.js.map +1 -1
- package/dist/esm/RenderingEngine/RenderingEngine.js +17 -1
- package/dist/esm/RenderingEngine/RenderingEngine.js.map +1 -1
- package/dist/esm/RenderingEngine/Viewport.js +6 -6
- package/dist/esm/RenderingEngine/Viewport.js.map +1 -1
- package/dist/types/RenderingEngine/RenderingEngine.d.ts.map +1 -1
- package/dist/types/RenderingEngine/Viewport.d.ts.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/RenderingEngine/RenderingEngine.ts +19 -1
- package/src/RenderingEngine/Viewport.ts +21 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "1.61.
|
|
3
|
+
"version": "1.61.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "individual",
|
|
48
48
|
"url": "https://ohif.org/donate"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "781483751c49ea99866976c6a1a938d96e0ef2c1"
|
|
51
51
|
}
|
|
@@ -627,10 +627,28 @@ class RenderingEngine implements IRenderingEngine {
|
|
|
627
627
|
canvas.height = rect.height * devicePixelRatio;
|
|
628
628
|
|
|
629
629
|
const prevCamera = vp.getCamera();
|
|
630
|
+
const rotation = vp.getRotation();
|
|
631
|
+
const pan = vp.getPan();
|
|
632
|
+
const zoom = vp.getZoom();
|
|
633
|
+
const { flipHorizontal } = prevCamera;
|
|
630
634
|
vp.resetCamera();
|
|
631
635
|
|
|
636
|
+
const displayArea = vp.getDisplayArea();
|
|
637
|
+
|
|
638
|
+
// TODO - make this use get/set Presentation or in some way preserve the
|
|
639
|
+
// basic presentation info on this viewport, rather than preserving camera
|
|
632
640
|
if (keepCamera) {
|
|
633
|
-
|
|
641
|
+
if (displayArea) {
|
|
642
|
+
if (flipHorizontal) {
|
|
643
|
+
vp.setCamera({ flipHorizontal });
|
|
644
|
+
}
|
|
645
|
+
if (rotation) {
|
|
646
|
+
vp.setProperties({ rotation });
|
|
647
|
+
}
|
|
648
|
+
console.log('What to do with pan and zoom', pan[0], pan[1], zoom);
|
|
649
|
+
} else {
|
|
650
|
+
vp.setCamera(prevCamera);
|
|
651
|
+
}
|
|
634
652
|
}
|
|
635
653
|
});
|
|
636
654
|
|
|
@@ -604,8 +604,10 @@ class Viewport implements IViewport {
|
|
|
604
604
|
): void {
|
|
605
605
|
const { storeAsInitialCamera } = displayArea;
|
|
606
606
|
|
|
607
|
-
//
|
|
608
|
-
|
|
607
|
+
// Setup the current camera as the fit to canvas camera as the one that is
|
|
608
|
+
// used as the base for calculations, but it isn't final, so don't fire
|
|
609
|
+
// events because the camera is still changing.
|
|
610
|
+
this.setCameraNoEvent(this.fitToCanvasCamera);
|
|
609
611
|
|
|
610
612
|
const { imageArea, imageCanvasPoint } = displayArea;
|
|
611
613
|
|
|
@@ -613,7 +615,10 @@ class Viewport implements IViewport {
|
|
|
613
615
|
if (imageArea) {
|
|
614
616
|
const [areaX, areaY] = imageArea;
|
|
615
617
|
zoom = Math.min(this.getZoom() / areaX, this.getZoom() / areaY);
|
|
616
|
-
|
|
618
|
+
// Don't set as initial camera because then the zoom interactions don't
|
|
619
|
+
// work consistently.
|
|
620
|
+
// TODO: Add a better method to handle initial camera
|
|
621
|
+
this.setZoom(this.insetImageMultiplier * zoom);
|
|
617
622
|
}
|
|
618
623
|
|
|
619
624
|
// getting the image info
|
|
@@ -627,12 +632,14 @@ class Viewport implements IViewport {
|
|
|
627
632
|
const canvasPanX = validateCanvasPanX * (canvasX - 0.5);
|
|
628
633
|
const canvasPanY = validateCanvasPanY * (canvasY - 0.5);
|
|
629
634
|
const dimensions = imageData.getDimensions();
|
|
630
|
-
const canvasZero = this.worldToCanvas([0, 0, 0]);
|
|
631
|
-
const canvasEdge = this.worldToCanvas(
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
635
|
+
const canvasZero = this.worldToCanvas(imageData.indexToWorld([0, 0, 0]));
|
|
636
|
+
const canvasEdge = this.worldToCanvas(
|
|
637
|
+
imageData.indexToWorld([
|
|
638
|
+
dimensions[0] - 1,
|
|
639
|
+
dimensions[1] - 1,
|
|
640
|
+
dimensions[2],
|
|
641
|
+
])
|
|
642
|
+
);
|
|
636
643
|
const canvasImage = [
|
|
637
644
|
canvasEdge[0] - canvasZero[0],
|
|
638
645
|
canvasEdge[1] - canvasZero[1],
|
|
@@ -647,9 +654,13 @@ class Viewport implements IViewport {
|
|
|
647
654
|
const newPositionY = imagePanY + canvasPanY;
|
|
648
655
|
|
|
649
656
|
const deltaPoint2: Point2 = [newPositionX, newPositionY];
|
|
650
|
-
|
|
657
|
+
// The pan is part of the display area settings, not the initial camera, so
|
|
658
|
+
// don't store as initial camera here - that breaks rotation and other changes.
|
|
659
|
+
this.setPan(deltaPoint2);
|
|
651
660
|
}
|
|
652
661
|
|
|
662
|
+
// Instead of storing the camera itself, if initial camera is set,
|
|
663
|
+
// then store the display area as the baseline display area.
|
|
653
664
|
if (storeAsInitialCamera) {
|
|
654
665
|
this.options.displayArea = displayArea;
|
|
655
666
|
}
|