Merge branch 'RED-7296' into 'master'

RED-7296: delete drawn rectangle upon deselect.

See merge request redactmanager/red-ui!297
This commit is contained in:
Dan Percic 2024-02-12 12:07:00 +01:00
commit 9a368bc8a0

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