From f8e2f9ecce0f5859f09460843ef3efb536c42805 Mon Sep 17 00:00:00 2001 From: Ouwen Huang Date: Wed, 12 Apr 2023 02:47:23 +0000 Subject: [PATCH] feat(crosshairs): added threshold for jumpWorld --- packages/tools/src/tools/CrosshairsTool.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/tools/src/tools/CrosshairsTool.ts b/packages/tools/src/tools/CrosshairsTool.ts index 32ca4d4e71..78e9afb2bf 100644 --- a/packages/tools/src/tools/CrosshairsTool.ts +++ b/packages/tools/src/tools/CrosshairsTool.ts @@ -71,6 +71,7 @@ interface ToolConfiguration { opacity: number; handleRadius: number; }; + jumpThreshold: number; }; } @@ -162,6 +163,7 @@ class CrosshairsTool extends AnnotationTool { opacity: 0.8, handleRadius: 9, }, + jumpThreshold: 0, }, } ) { @@ -390,6 +392,15 @@ class CrosshairsTool extends AnnotationTool { const enabledElement = getEnabledElement(element); const { viewport } = enabledElement; + + if (this.configuration.jumpThreshold) { + const distance = vec3.distance( + vec3.fromValues(...jumpWorld), + vec3.fromValues(...this.toolCenter) + ); + if (distance > this.configuration.jumpThreshold) return; + } + this._jump(enabledElement, jumpWorld); const annotations = this._getAnnotations(enabledElement);