From 40067ff6e6cf3b7414bbffdc32aa5de70c5a3d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Sat, 24 Oct 2020 00:13:26 +0300 Subject: [PATCH] Fixes --- .../file-preview-screen.component.html | 8 ++++++-- .../file-preview-screen.component.ts | 6 ++---- .../screens/file/pdf-viewer/pdf-viewer.component.ts | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html index 1c391c203..92fe4d1f8 100644 --- a/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html +++ b/apps/red-ui/src/app/screens/file/file-preview-screen/file-preview-screen.component.html @@ -126,7 +126,9 @@
-
+
-
+
{{page}} 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 5e23a6307..58371212b 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 @@ -24,6 +24,7 @@ export class FilePreviewScreenComponent implements OnInit { private projectId: string; private _activeViewer: 'ANNOTATED' | 'REDACTED' = 'ANNOTATED'; + private instance: WebViewerInstance; @ViewChild(PdfViewerComponent) private _viewerComponent: PdfViewerComponent; @ViewChild('annotations') private _annotationsElement: ElementRef; @@ -37,8 +38,7 @@ export class FilePreviewScreenComponent implements OnInit { public selectedAnnotation: Annotations.Annotation; public filters: AnnotationFilters; public expandedFilters: AnnotationFilters = {hint: false}; - public pagesPanelActive = false; - private instance: WebViewerInstance; + public pagesPanelActive = true; constructor( public readonly appStateService: AppStateService, @@ -272,8 +272,6 @@ export class FilePreviewScreenComponent implements OnInit { @HostListener('window:keyup', ['$event']) handleKeyEvent($event: KeyboardEvent) { - $event.preventDefault(); - if ($event.key === 'ArrowLeft' || $event.key === 'ArrowRight') { this.pagesPanelActive = !this.pagesPanelActive; this._changeDetectorRef.detectChanges(); 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 4d948502f..981d94634 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 @@ -184,14 +184,14 @@ export class PdfViewerComponent implements OnInit, AfterViewInit, OnChanges { public selectAnnotation(annotation: Annotations.Annotation) { this.instance.annotManager.deselectAllAnnotations(); this.instance.annotManager.selectAnnotation(annotation); - this.instance.docViewer.displayPageLocation( - annotation.getPageNumber(), - 0, - annotation.getY() - 100); + this.navigateToPage(annotation.getPageNumber()); } public navigateToPage(pageNumber: number) { - this.instance.docViewer.displayPageLocation(pageNumber, 0, 0); + const activePage = this.instance.docViewer.getCurrentPage(); + if (activePage !== pageNumber) { + this.instance.docViewer.displayPageLocation(pageNumber, 0, 0); + } }