From 7d23b658cfccb176ddb1a0c49aa657e1ae904e33 Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Fri, 15 Sep 2023 17:16:18 -0400 Subject: [PATCH] fix(ruler): turn off hover when dragging --- src/composables/annotationTool.ts | 2 +- src/vtk/PolygonWidget/behavior.ts | 1 + src/vtk/RulerWidget/behavior.ts | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/composables/annotationTool.ts b/src/composables/annotationTool.ts index 884513578..27c4d1792 100644 --- a/src/composables/annotationTool.ts +++ b/src/composables/annotationTool.ts @@ -10,7 +10,7 @@ import { AnnotationTool, ContextMenuEvent } from '../types/annotation-tool'; import { AnnotationToolStore } from '../store/tools/useAnnotationTool'; import { getCSSCoordinatesFromEvent } from '../utils/vtk-helpers'; -const SHOW_OVERLAY_DELAY = 500; // milliseconds +const SHOW_OVERLAY_DELAY = 250; // milliseconds // does the tools's frame of reference match // the view's axis diff --git a/src/vtk/PolygonWidget/behavior.ts b/src/vtk/PolygonWidget/behavior.ts index 467d3a5b4..2e9c2d62f 100644 --- a/src/vtk/PolygonWidget/behavior.ts +++ b/src/vtk/PolygonWidget/behavior.ts @@ -152,6 +152,7 @@ export default function widgetBehavior(publicAPI: any, model: any) { publicAPI.handleLeftButtonPress = (event: vtkMouseEvent) => { const activeWidget = model._widgetManager.getActiveWidget(); + // turns off hover while dragging publicAPI.invokeHoverEvent({ ...event, hovering: false, diff --git a/src/vtk/RulerWidget/behavior.ts b/src/vtk/RulerWidget/behavior.ts index 6cc30853a..b04c3914e 100644 --- a/src/vtk/RulerWidget/behavior.ts +++ b/src/vtk/RulerWidget/behavior.ts @@ -73,6 +73,11 @@ export default function widgetBehavior(publicAPI: any, model: any) { return macro.VOID; } + publicAPI.invokeHoverEvent({ + ...eventData, + hovering: false, + }); + // This ruler widget is passive, so if another widget // is active, we don't do anything. const activeWidget = model._widgetManager.getActiveWidget(); @@ -135,11 +140,6 @@ export default function widgetBehavior(publicAPI: any, model: any) { * Moves a point around. */ publicAPI.handleMouseMove = (eventData: any) => { - publicAPI.invokeHoverEvent({ - ...eventData, - hovering: !!model.activeState, - }); - const worldCoords = model.manipulator.handleEvent( eventData, model._apiSpecificRenderWindow