Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OHI-1065] [OHI-1090] fix(probeTool): Implement isPointNearTool so EraserTool can detect probe measurements and delete them, use line width value from config for drawing the probe circle #1721

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/reviews/api/tools.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4464,7 +4464,7 @@ export class ProbeTool extends AnnotationTool {
// (undocumented)
isHandleOutsideImage: boolean;
// (undocumented)
isPointNearTool(): boolean;
isPointNearTool(element: HTMLDivElement, annotation: ProbeAnnotation, canvasCoords: Types_2.Point2, proximity: number): boolean;
// (undocumented)
static probeDefaults: {
supportedInteractionTypes: string[];
Expand Down
25 changes: 19 additions & 6 deletions packages/tools/src/tools/annotation/ProbeTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,20 @@ class ProbeTool extends AnnotationTool {
);
}

// Not necessary for this tool but needs to be defined since it's an abstract
// method from the parent class.
isPointNearTool(): boolean {
return false;
isPointNearTool(
element: HTMLDivElement,
annotation: ProbeAnnotation,
canvasCoords: Types.Point2,
proximity: number
): boolean {
const enabledElement = getEnabledElement(element);
const { viewport } = enabledElement;

const { data } = annotation;
const point = data.handles.points[0];
const annotationCanvasCoordinate = viewport.worldToCanvas(point);

return vec2.distance(canvasCoords, annotationCanvasCoordinate) < proximity;
}

toolSelectedCallback() {}
Expand Down Expand Up @@ -471,7 +481,10 @@ class ProbeTool extends AnnotationTool {

styleSpecifier.annotationUID = annotationUID;

const { color } = this.getAnnotationStyle({ annotation, styleSpecifier });
const { color, lineWidth } = this.getAnnotationStyle({
annotation,
styleSpecifier,
});

if (!data.cachedStats) {
data.cachedStats = {};
Expand Down Expand Up @@ -545,7 +558,7 @@ class ProbeTool extends AnnotationTool {
annotationUID,
handleGroupUID,
[canvasCoordinates],
{ color }
{ color, lineWidth }
);

renderStatus = true;
Expand Down
Loading