From 9f5e42f324dc562b8764dd296f5b7b0033276798 Mon Sep 17 00:00:00 2001 From: Timo Bejan Date: Fri, 30 Oct 2020 14:30:19 +0200 Subject: [PATCH] minor fixes for arrow nav --- .../file-preview-screen/file-preview-screen.component.ts | 3 +-- .../src/app/screens/file/pdf-viewer/pdf-viewer.component.ts | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts index a2571f4b6..0e0c96f73 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.ts @@ -272,7 +272,6 @@ export class FilePreviewScreenComponent implements OnInit { public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) { this.ngZone.run(() => { this._dialogRef = this._dialogService.rejectSuggestion($event, annotation, () => { - console.log('Reject Callback'); this.activeViewer.annotManager.deleteAnnotation(annotation.annotation, false, true); }); }); @@ -368,7 +367,7 @@ export class FilePreviewScreenComponent implements OnInit { const page = this.selectedAnnotation.pageNumber; const pageIdx = this.displayedPages.indexOf(page); const annotationsOnPage = this.displayedAnnotations[page].annotations; - const idx = annotationsOnPage.indexOf(this.selectedAnnotation); + const idx = annotationsOnPage.findIndex((a) => a.id === this.selectedAnnotation.id); if ($event.key === 'ArrowDown') { if (idx + 1 !== annotationsOnPage.length) { diff --git a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts index 1983f4c2c..e0f6bb6f6 100644 --- a/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts +++ b/apps/red-ui/src/app/screens/file/pdf-viewer/pdf-viewer.component.ts @@ -273,8 +273,10 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { public selectAnnotation(annotation: AnnotationWrapper) { this.instance.annotManager.deselectAllAnnotations(); - this.instance.annotManager.selectAnnotation(annotation.annotation); - this.navigateToPage(annotation.pageNumber); + if (annotation?.annotation) { + this.instance.annotManager.selectAnnotation(annotation.annotation); + this.navigateToPage(annotation.pageNumber); + } } public navigateToPage(pageNumber: number) {