@cornerstonejs/core 1.28.0 → 1.28.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "1.28.0",
3
+ "version": "1.28.2",
4
4
  "description": "",
5
5
  "main": "src/index.ts",
6
6
  "types": "dist/esm/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "type": "individual",
47
47
  "url": "https://ohif.org/donate"
48
48
  },
49
- "gitHead": "2657d8d490df8f84ad372733fa0c61355ee8767a"
49
+ "gitHead": "dde6ed05ccc26a500ed7432c3afdf98a6dffdabf"
50
50
  }
@@ -1039,6 +1039,33 @@ class StackViewport extends Viewport implements IStackViewport {
1039
1039
  triggerEvent(this.element, Events.CAMERA_MODIFIED, eventDetail);
1040
1040
  }
1041
1041
 
1042
+ private getPanCPU(): Point2 {
1043
+ const { viewport } = this._cpuFallbackEnabledElement;
1044
+
1045
+ return [viewport.translation.x, viewport.translation.y];
1046
+ }
1047
+
1048
+ private setPanCPU(pan: Point2): void {
1049
+ const camera = this.getCameraCPU();
1050
+
1051
+ this.setCameraCPU({
1052
+ ...camera,
1053
+ focalPoint: [...pan.map((p) => -p), 0] as Point3,
1054
+ });
1055
+ }
1056
+
1057
+ private getZoomCPU(): number {
1058
+ const { viewport } = this._cpuFallbackEnabledElement;
1059
+
1060
+ return viewport.scale;
1061
+ }
1062
+
1063
+ private setZoomCPU(zoom: number): void {
1064
+ const camera = this.getCameraCPU();
1065
+
1066
+ this.setCameraCPU({ ...camera, scale: zoom });
1067
+ }
1068
+
1042
1069
  private setFlipCPU({ flipHorizontal, flipVertical }: FlipDirection): void {
1043
1070
  const { viewport } = this._cpuFallbackEnabledElement;
1044
1071
 
@@ -2927,6 +2954,22 @@ class StackViewport extends Viewport implements IStackViewport {
2927
2954
  cpu: this.setCameraCPU,
2928
2955
  gpu: super.setCamera,
2929
2956
  },
2957
+ getPan: {
2958
+ cpu: this.getPanCPU,
2959
+ gpu: super.getPan,
2960
+ },
2961
+ setPan: {
2962
+ cpu: this.setPanCPU,
2963
+ gpu: super.setPan,
2964
+ },
2965
+ getZoom: {
2966
+ cpu: this.getZoomCPU,
2967
+ gpu: super.getZoom,
2968
+ },
2969
+ setZoom: {
2970
+ cpu: this.setZoomCPU,
2971
+ gpu: super.setZoom,
2972
+ },
2930
2973
  setVOI: {
2931
2974
  cpu: this.setVOICPU,
2932
2975
  gpu: this.setVOIGPU,