Skip to content

Commit

Permalink
fix(CrosshairsTool): support HPDI screens in CrosshairsTool
Browse files Browse the repository at this point in the history
fix #1822
  • Loading branch information
daker committed Feb 13, 2025
1 parent 5c61d76 commit 5e1c053
Showing 1 changed file with 19 additions and 26 deletions.
45 changes: 19 additions & 26 deletions packages/tools/src/tools/CrosshairsTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,13 @@ class CrosshairsTool extends AnnotationTool {
slabThicknessHandleWorldFour
);

let handleRadius = 3 * window.devicePixelRatio;
let opacity = 1;
if (this.configuration.mobile.enabled) {
handleRadius = this.configuration.mobile.handleRadius;
opacity = this.configuration.mobile.opacity;
}

if (
(lineActive || this.configuration.mobile?.enabled) &&
!rotHandlesActive &&
Expand All @@ -1289,12 +1296,8 @@ class CrosshairsTool extends AnnotationTool {
rotationHandles,
{
color,
handleRadius: this.configuration.mobile?.enabled
? this.configuration.mobile?.handleRadius
: 3,
opacity: this.configuration.mobile?.enabled
? this.configuration.mobile?.opacity
: 1,
handleRadius,
opacity,
type: 'circle',
}
);
Expand All @@ -1306,12 +1309,8 @@ class CrosshairsTool extends AnnotationTool {
slabThicknessHandles,
{
color,
handleRadius: this.configuration.mobile?.enabled
? this.configuration.mobile?.handleRadius
: 3,
opacity: this.configuration.mobile?.enabled
? this.configuration.mobile?.opacity
: 1,
handleRadius,
opacity,
type: 'rect',
}
);
Expand All @@ -1330,12 +1329,8 @@ class CrosshairsTool extends AnnotationTool {
rotationHandles,
{
color,
handleRadius: this.configuration.mobile?.enabled
? this.configuration.mobile?.handleRadius
: 3,
opacity: this.configuration.mobile?.enabled
? this.configuration.mobile?.opacity
: 1,
handleRadius,
opacity,
type: 'circle',
}
);
Expand All @@ -1354,17 +1349,14 @@ class CrosshairsTool extends AnnotationTool {
slabThicknessHandles,
{
color,
handleRadius: this.configuration.mobile?.enabled
? this.configuration.mobile?.handleRadius
: 3,
opacity: this.configuration.mobile?.enabled
? this.configuration.mobile?.opacity
: 1,
handleRadius,
opacity,
type: 'rect',
}
);
} else if (rotHandlesActive && viewportDraggableRotatable) {
const handleUID = `${lineIndex}`;
const handleRadius = 2 * window.devicePixelRatio;
// draw all rotation handles as active
drawHandlesSvg(
svgDrawingHelper,
Expand All @@ -1373,7 +1365,7 @@ class CrosshairsTool extends AnnotationTool {
rotationHandles,
{
color,
handleRadius: 2,
handleRadius,
fill: color,
type: 'circle',
}
Expand All @@ -1383,6 +1375,7 @@ class CrosshairsTool extends AnnotationTool {
selectedViewportId &&
viewportSlabThicknessControlsOn
) {
const handleRadius = 2 * window.devicePixelRatio;
// draw only the slab thickness handles for the active viewport as active
drawHandlesSvg(
svgDrawingHelper,
Expand All @@ -1391,7 +1384,7 @@ class CrosshairsTool extends AnnotationTool {
slabThicknessHandles,
{
color,
handleRadius: 2,
handleRadius,
fill: color,
type: 'rect',
}
Expand Down

0 comments on commit 5e1c053

Please sign in to comment.