@cornerstonejs/core 3.1.1 → 3.1.2

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.
@@ -67,6 +67,7 @@ declare abstract class BaseVolumeViewport extends Viewport {
67
67
  setCamera(cameraInterface: ICamera, storeAsInitialCamera?: boolean): void;
68
68
  private _setVolumeActors;
69
69
  canvasToWorld: (canvasPos: Point2) => Point3;
70
+ getVTKDisplayCoords: (canvasPos: Point2) => Point3;
70
71
  worldToCanvas: (worldPos: Point3) => Point2;
71
72
  hasImageURI: (imageURI: string) => boolean;
72
73
  protected _getOrientationVectors(orientation: OrientationAxis | OrientationVectors): OrientationVectors;
@@ -151,22 +151,28 @@ class BaseVolumeViewport extends Viewport {
151
151
  const vtkCamera = this.getVtkActiveCamera();
152
152
  vtkCamera.setIsPerformingCoordinateTransformation?.(true);
153
153
  const renderer = this.getRenderer();
154
+ const displayCoords = this.getVTKDisplayCoords(canvasPos);
154
155
  const offscreenMultiRenderWindow = this.getRenderingEngine().offscreenMultiRenderWindow;
155
156
  const openGLRenderWindow = offscreenMultiRenderWindow.getOpenGLRenderWindow();
156
- const size = openGLRenderWindow.getSize();
157
+ const worldCoord = openGLRenderWindow.displayToWorld(displayCoords[0], displayCoords[1], displayCoords[2], renderer);
158
+ vtkCamera.setIsPerformingCoordinateTransformation?.(false);
159
+ return [worldCoord[0], worldCoord[1], worldCoord[2]];
160
+ };
161
+ this.getVTKDisplayCoords = (canvasPos) => {
157
162
  const devicePixelRatio = window.devicePixelRatio || 1;
158
163
  const canvasPosWithDPR = [
159
164
  canvasPos[0] * devicePixelRatio,
160
165
  canvasPos[1] * devicePixelRatio,
161
166
  ];
167
+ const offscreenMultiRenderWindow = this.getRenderingEngine().offscreenMultiRenderWindow;
168
+ const openGLRenderWindow = offscreenMultiRenderWindow.getOpenGLRenderWindow();
169
+ const size = openGLRenderWindow.getSize();
162
170
  const displayCoord = [
163
171
  canvasPosWithDPR[0] + this.sx,
164
172
  canvasPosWithDPR[1] + this.sy,
165
173
  ];
166
174
  displayCoord[1] = size[1] - displayCoord[1];
167
- const worldCoord = openGLRenderWindow.displayToWorld(displayCoord[0], displayCoord[1], 0, renderer);
168
- vtkCamera.setIsPerformingCoordinateTransformation?.(false);
169
- return [worldCoord[0], worldCoord[1], worldCoord[2]];
175
+ return [displayCoord[0], displayCoord[1], 0];
170
176
  };
171
177
  this.worldToCanvas = (worldPos) => {
172
178
  const vtkCamera = this.getVtkActiveCamera();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -81,5 +81,5 @@
81
81
  "type": "individual",
82
82
  "url": "https://ohif.org/donate"
83
83
  },
84
- "gitHead": "91a215bf75b76f6cbd017a811b5dfcff60f7f060"
84
+ "gitHead": "eb97520fe08be3b204a9b8a6d77463e5207f3422"
85
85
  }