From 394182b9378c4247a919fc7dbfd7888c738c89e1 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Mon, 12 Feb 2024 12:50:13 +0200 Subject: [PATCH] RED-7296: delete drawn rectangle upon deselect. --- .../pdf-viewer/services/annotation-manager.service.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts index 2d4443999..efec37cac 100644 --- a/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts +++ b/apps/red-ui/src/app/modules/pdf-viewer/services/annotation-manager.service.ts @@ -141,6 +141,11 @@ export class REDAnnotationManager { this.#manager.addEventListener('annotationSelected', (annotations: Annotation[], action: string) => { this.#logger.info('[PDF] Annotation selected: ', annotations, action); this.#annotationSelected$.next([annotations, action]); + + const annotation = annotations.length === 1 ? annotations[0] : undefined; + if (annotation && annotation.ToolName === AnnotationToolNames.AnnotationCreateRectangle && action === 'deselected') { + this.delete(annotation.Id); + } }); }