auto select rectangle after drawing

This commit is contained in:
Dan Percic 2021-04-09 12:36:30 +03:00
parent 0e029b205d
commit 7bbf656e41

View File

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