RED-4590: Replace else statments with early returns.
This commit is contained in:
parent
c88da50045
commit
588432a0db
@ -410,32 +410,32 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnDestroy
|
||||
private _navigatePages($event: KeyboardEvent) {
|
||||
const pageIdx = this.displayedPages.indexOf(this.activeViewerPage);
|
||||
|
||||
if ($event.key === 'ArrowDown') {
|
||||
if (pageIdx !== -1) {
|
||||
// If active page has annotations
|
||||
if (pageIdx !== this.displayedPages.length - 1) {
|
||||
this.pdf.navigateTo(this.displayedPages[pageIdx + 1]);
|
||||
}
|
||||
} else {
|
||||
// If active page doesn't have annotations
|
||||
const nextPage = this._nextPageWithAnnotations();
|
||||
if (nextPage) {
|
||||
this.pdf.navigateTo(nextPage);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pageIdx !== -1) {
|
||||
// If active page has annotations
|
||||
if (pageIdx !== 0) {
|
||||
this.pdf.navigateTo(this.displayedPages[pageIdx - 1]);
|
||||
}
|
||||
} else {
|
||||
if ($event.key !== 'ArrowDown') {
|
||||
if (pageIdx === -1) {
|
||||
// If active page doesn't have annotations
|
||||
const prevPage = this._prevPageWithAnnotations();
|
||||
if (prevPage) {
|
||||
this.pdf.navigateTo(prevPage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// If active page has annotations
|
||||
if (pageIdx !== 0) {
|
||||
this.pdf.navigateTo(this.displayedPages[pageIdx - 1]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pageIdx === -1) {
|
||||
// If active page doesn't have annotations
|
||||
const nextPage = this._nextPageWithAnnotations();
|
||||
if (nextPage) {
|
||||
this.pdf.navigateTo(nextPage);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// If active page has annotations
|
||||
if (pageIdx !== this.displayedPages.length - 1) {
|
||||
this.pdf.navigateTo(this.displayedPages[pageIdx + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user