diff --git a/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts index 70e24b7b2..830be92a9 100644 --- a/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/modules/projects/components/pdf-viewer/pdf-viewer.component.ts @@ -114,6 +114,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { } }); + instance.annotManager.on('annotationChanged', (annotations) => { + // when a rectangle is drawn, it returns one annotation with tool name 'AnnotationCreateRectangle; + // this will auto select rectangle after drawing + if (annotations.length === 1 && annotations[0].ToolName === 'AnnotationCreateRectangle') { + instance.annotManager.selectAnnotations(annotations); + } + }); + instance.docViewer.on('pageNumberUpdated', (p) => { if (this.shouldDeselectAnnotationsOnPageChange) { this.instance.annotManager.deselectAllAnnotations();