Fixed arrow navigation

This commit is contained in:
Adina Țeudan 2022-01-12 13:09:06 +02:00
parent 95e898c03c
commit f7bc532675
2 changed files with 22 additions and 21 deletions

View File

@ -67,7 +67,7 @@
<redaction-pdf-viewer
(annotationSelected)="handleAnnotationSelected($event)"
(annotationsChanged)="annotationsChangedByReviewAction($event)"
(keyUp)="handleKeyEvent($event)"
(keyUp)="handleKeyEvent($event); handleArrowEvent($event)"
(manualAnnotationRequested)="openManualAnnotationDialog($event)"
(pageChanged)="viewerPageChanged($event)"
(viewerReady)="viewerReady($event)"

View File

@ -144,19 +144,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return this._instance;
}
private _setActiveViewerPage() {
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
if (!currentPage) {
this.activeViewerPage = 1;
} else {
this.activeViewerPage = this.viewModeService.isCompare
? currentPage % 2 === 0
? currentPage / 2
: (currentPage + 1) / 2
: currentPage;
}
}
private get _canPerformAnnotationActions$() {
return combineLatest([this.file$, this.viewModeService.viewMode$]).pipe(
map(([file, viewMode]) => this.permissionsService.canPerformAnnotationActions(file) && viewMode === 'STANDARD'),
@ -331,6 +318,14 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
}
}
handleArrowEvent($event: KeyboardEvent): void {
if (['ArrowUp', 'ArrowDown'].includes($event.key)) {
if (this.selectedAnnotations.length === 1) {
this._workloadComponent.navigateAnnotations($event);
}
}
}
@HostListener('window:keyup', ['$event'])
handleKeyEvent($event: KeyboardEvent) {
if (this._router.url.indexOf('/file/') < 0) {
@ -341,13 +336,6 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return;
}
if (['ArrowUp', 'ArrowDown'].includes($event.key)) {
if (this.selectedAnnotations.length === 1) {
this._workloadComponent.navigateAnnotations($event);
}
return;
}
if (['Escape'].includes($event.key)) {
this.fullScreen = false;
this.closeFullScreen();
@ -447,6 +435,19 @@ export class FilePreviewScreenComponent extends AutoUnsubscribe implements OnIni
return false;
}
private _setActiveViewerPage() {
const currentPage = this._instance?.Core.documentViewer?.getCurrentPage();
if (!currentPage) {
this.activeViewerPage = 1;
} else {
this.activeViewerPage = this.viewModeService.isCompare
? currentPage % 2 === 0
? currentPage / 2
: (currentPage + 1) / 2
: currentPage;
}
}
private _setExcludedPageStyles() {
const file = this._filesMapService.get(this.dossierId, this.fileId);
setTimeout(() => {