From f8e75f3d236da91c2710b4742ff2c2047e3e0e3c Mon Sep 17 00:00:00 2001 From: Chris Yi Date: Fri, 28 Apr 2023 21:41:05 +0800 Subject: [PATCH] fix(annotations): fix triggering of 'ANNOTATION_ADDED' event multiple times (#570) (#584) --- .../src/stateManagement/annotation/annotationState.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/tools/src/stateManagement/annotation/annotationState.ts b/packages/tools/src/stateManagement/annotation/annotationState.ts index 952d467b82..e662530da8 100644 --- a/packages/tools/src/stateManagement/annotation/annotationState.ts +++ b/packages/tools/src/stateManagement/annotation/annotationState.ts @@ -88,13 +88,13 @@ function addAnnotation( // annotation added event for that element. if (annotationGroupSelector instanceof HTMLDivElement) { triggerAnnotationAddedForElement(annotation, annotationGroupSelector); + } else { + // if no element is provided, render all viewports that have the + // same frame of reference. + // Todo: we should do something else here for other types of annotation managers. + triggerAnnotationAddedForFOR(annotation); } - // if no element is provided, render all viewports that have the - // same frame of reference. - // Todo: we should do something else here for other types of annotation managers. - triggerAnnotationAddedForFOR(annotation); - return annotation.annotationUID; }