@cornerstonejs/tools 0.61.11 → 0.62.1

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/tools",
3
- "version": "0.61.11",
3
+ "version": "0.62.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
27
27
  },
28
28
  "dependencies": {
29
- "@cornerstonejs/core": "^0.42.2",
29
+ "@cornerstonejs/core": "^0.42.3",
30
30
  "lodash.clonedeep": "4.5.0",
31
31
  "lodash.get": "^4.4.2"
32
32
  },
@@ -52,5 +52,5 @@
52
52
  "type": "individual",
53
53
  "url": "https://ohif.org/donate"
54
54
  },
55
- "gitHead": "f3d10f612cf03767108e076ef8b9370c6247bdd0"
55
+ "gitHead": "f3db864a642cb3a4e56dd19b2fedaa6815bcf3a7"
56
56
  }
@@ -61,6 +61,7 @@ interface ToolConfiguration {
61
61
  getReferenceLineControllable?: (viewportId: string) => boolean;
62
62
  getReferenceLineDraggableRotatable?: (viewportId: string) => boolean;
63
63
  getReferenceLineSlabThicknessControlsOn?: (viewportId: string) => boolean;
64
+ referenceLinesCenterGapRadius?: number;
64
65
  shadow?: boolean;
65
66
  autopan?: {
66
67
  enabled: boolean;
@@ -152,6 +153,10 @@ class CrosshairsTool extends AnnotationTool {
152
153
  enabled: false,
153
154
  panSize: 10,
154
155
  },
156
+ // radius of the area around the intersection of the planes, in which
157
+ // the reference lines will not be rendered. This is only used when
158
+ // having 3 viewports in the toolGroup.
159
+ referenceLinesCenterGapRadius: 20,
155
160
  // actorUIDs for slabThickness application, if not defined, the slab thickness
156
161
  // will be applied to all actors of the viewport
157
162
  filterActorUIDsToSetSlabThickness: [],
@@ -770,6 +775,7 @@ class CrosshairsTool extends AnnotationTool {
770
775
  const canvasDiagonalLength = Math.sqrt(
771
776
  clientWidth * clientWidth + clientHeight * clientHeight
772
777
  );
778
+ const canvasMinDimensionLength = Math.min(clientWidth, clientHeight);
773
779
 
774
780
  const data = viewportAnnotation.data;
775
781
  const crosshairCenterCanvas = viewport.worldToCanvas(this.toolCenter);
@@ -878,7 +884,6 @@ class CrosshairsTool extends AnnotationTool {
878
884
  // Long
879
885
  const canvasVectorFromCenterLong = vec2.create();
880
886
 
881
- // Todo: configuration should provide constants below (100, 0.25, 0.15, 0.04)
882
887
  vec2.scale(
883
888
  canvasVectorFromCenterLong,
884
889
  canvasUnitVectorFromCenter,
@@ -888,20 +893,25 @@ class CrosshairsTool extends AnnotationTool {
888
893
  vec2.scale(
889
894
  canvasVectorFromCenterMid,
890
895
  canvasUnitVectorFromCenter,
891
- canvasDiagonalLength * 0.25
896
+ // to maximize the visibility of the controls, they need to be
897
+ // placed at most at half the length of the shortest side of the canvas.
898
+ // Chosen 0.4 to have some margin to the edge.
899
+ canvasMinDimensionLength * 0.4
892
900
  );
893
901
  const canvasVectorFromCenterShort = vec2.create();
894
902
  vec2.scale(
895
903
  canvasVectorFromCenterShort,
896
904
  canvasUnitVectorFromCenter,
897
- canvasDiagonalLength * 0.15
905
+ // Chosen 0.2 because is half of 0.4.
906
+ canvasMinDimensionLength * 0.2
898
907
  );
899
908
  const canvasVectorFromCenterStart = vec2.create();
909
+ const centerGap = this.configuration.referenceLinesCenterGapRadius;
900
910
  vec2.scale(
901
911
  canvasVectorFromCenterStart,
902
912
  canvasUnitVectorFromCenter,
903
913
  // Don't put a gap if the the third view is missing
904
- otherViewportAnnotations.length === 2 ? canvasDiagonalLength * 0.04 : 0
914
+ otherViewportAnnotations.length === 2 ? centerGap : 0
905
915
  );
906
916
 
907
917
  // Computing Reference start and end (4 lines per viewport in case of 3 view MPR)