RED-7296: delete drawn rectangle upon deselect.

This commit is contained in:
Nicoleta Panaghiu 2024-02-12 12:50:13 +02:00
parent be1c9c66f0
commit 394182b937

View File

@ -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);
}
});
}