minor fixes for arrow nav

This commit is contained in:
Timo Bejan 2020-10-30 14:30:19 +02:00
parent 34af8ae3c7
commit 9f5e42f324
2 changed files with 5 additions and 4 deletions

View File

@ -272,7 +272,6 @@ export class FilePreviewScreenComponent implements OnInit {
public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) { public rejectSuggestion($event: MouseEvent, annotation: AnnotationWrapper) {
this.ngZone.run(() => { this.ngZone.run(() => {
this._dialogRef = this._dialogService.rejectSuggestion($event, annotation, () => { this._dialogRef = this._dialogService.rejectSuggestion($event, annotation, () => {
console.log('Reject Callback');
this.activeViewer.annotManager.deleteAnnotation(annotation.annotation, false, true); this.activeViewer.annotManager.deleteAnnotation(annotation.annotation, false, true);
}); });
}); });
@ -368,7 +367,7 @@ export class FilePreviewScreenComponent implements OnInit {
const page = this.selectedAnnotation.pageNumber; const page = this.selectedAnnotation.pageNumber;
const pageIdx = this.displayedPages.indexOf(page); const pageIdx = this.displayedPages.indexOf(page);
const annotationsOnPage = this.displayedAnnotations[page].annotations; 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 ($event.key === 'ArrowDown') {
if (idx + 1 !== annotationsOnPage.length) { if (idx + 1 !== annotationsOnPage.length) {

View File

@ -273,8 +273,10 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges {
public selectAnnotation(annotation: AnnotationWrapper) { public selectAnnotation(annotation: AnnotationWrapper) {
this.instance.annotManager.deselectAllAnnotations(); this.instance.annotManager.deselectAllAnnotations();
this.instance.annotManager.selectAnnotation(annotation.annotation); if (annotation?.annotation) {
this.navigateToPage(annotation.pageNumber); this.instance.annotManager.selectAnnotation(annotation.annotation);
this.navigateToPage(annotation.pageNumber);
}
} }
public navigateToPage(pageNumber: number) { public navigateToPage(pageNumber: number) {