@cornerstonejs/adapters 1.61.2 → 1.61.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.
@@ -40803,7 +40803,7 @@ class Viewport {
40803
40803
  const {
40804
40804
  storeAsInitialCamera
40805
40805
  } = displayArea;
40806
- this.setCamera(this.fitToCanvasCamera, storeAsInitialCamera);
40806
+ this.setCameraNoEvent(this.fitToCanvasCamera);
40807
40807
  const {
40808
40808
  imageArea,
40809
40809
  imageCanvasPoint
@@ -40812,7 +40812,7 @@ class Viewport {
40812
40812
  if (imageArea) {
40813
40813
  const [areaX, areaY] = imageArea;
40814
40814
  zoom = Math.min(this.getZoom() / areaX, this.getZoom() / areaY);
40815
- this.setZoom(this.insetImageMultiplier * zoom, storeAsInitialCamera);
40815
+ this.setZoom(this.insetImageMultiplier * zoom);
40816
40816
  }
40817
40817
  const imageData = this.getDefaultImageData();
40818
40818
  if (imageCanvasPoint && imageData) {
@@ -40827,8 +40827,8 @@ class Viewport {
40827
40827
  const canvasPanX = validateCanvasPanX * (canvasX - 0.5);
40828
40828
  const canvasPanY = validateCanvasPanY * (canvasY - 0.5);
40829
40829
  const dimensions = imageData.getDimensions();
40830
- const canvasZero = this.worldToCanvas([0, 0, 0]);
40831
- const canvasEdge = this.worldToCanvas([dimensions[0] - 1, dimensions[1] - 1, dimensions[2]]);
40830
+ const canvasZero = this.worldToCanvas(imageData.indexToWorld([0, 0, 0]));
40831
+ const canvasEdge = this.worldToCanvas(imageData.indexToWorld([dimensions[0] - 1, dimensions[1] - 1, dimensions[2]]));
40832
40832
  const canvasImage = [canvasEdge[0] - canvasZero[0], canvasEdge[1] - canvasZero[1]];
40833
40833
  const [imgWidth, imgHeight] = canvasImage;
40834
40834
  const [imageX, imageY] = imagePoint;
@@ -40837,7 +40837,7 @@ class Viewport {
40837
40837
  const newPositionX = imagePanX + canvasPanX;
40838
40838
  const newPositionY = imagePanY + canvasPanY;
40839
40839
  const deltaPoint2 = [newPositionX, newPositionY];
40840
- this.setPan(deltaPoint2, storeAsInitialCamera);
40840
+ this.setPan(deltaPoint2);
40841
40841
  }
40842
40842
  if (storeAsInitialCamera) {
40843
40843
  this.options.displayArea = displayArea;
@@ -47602,9 +47602,30 @@ class RenderingEngine {
47602
47602
  canvas.width = rect.width * devicePixelRatio;
47603
47603
  canvas.height = rect.height * devicePixelRatio;
47604
47604
  const prevCamera = vp.getCamera();
47605
+ const rotation = vp.getRotation();
47606
+ const pan = vp.getPan();
47607
+ const zoom = vp.getZoom();
47608
+ const {
47609
+ flipHorizontal
47610
+ } = prevCamera;
47605
47611
  vp.resetCamera();
47612
+ const displayArea = vp.getDisplayArea();
47606
47613
  if (keepCamera) {
47607
- vp.setCamera(prevCamera);
47614
+ if (displayArea) {
47615
+ if (flipHorizontal) {
47616
+ vp.setCamera({
47617
+ flipHorizontal
47618
+ });
47619
+ }
47620
+ if (rotation) {
47621
+ vp.setProperties({
47622
+ rotation
47623
+ });
47624
+ }
47625
+ console.log('What to do with pan and zoom', pan[0], pan[1], zoom);
47626
+ } else {
47627
+ vp.setCamera(prevCamera);
47628
+ }
47608
47629
  }
47609
47630
  });
47610
47631
  if (immediate === true) {