#68 add shortcut

This commit is contained in:
Eugenio Romano
2016-06-03 12:36:19 +01:00
parent 26c1ecbb6a
commit 129a369a2a
2 changed files with 43 additions and 3 deletions

View File

@@ -103,7 +103,7 @@ export class ViewerComponent {
* load the previous page
*/
previousPage() {
if (this.page > 1) {
if (this.pdfViewer && this.page > 1) {
this.page--;
this.displayPage = this.page;
@@ -121,7 +121,7 @@ export class ViewerComponent {
* load the next page
*/
nextPage() {
if (this.page < this.totalPages) {
if (this.pdfViewer && this.page < this.totalPages) {
this.page++;
this.displayPage = this.page;
@@ -149,8 +149,12 @@ export class ViewerComponent {
@HostListener('document:keydown', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
let key = event.keyCode;
if (key === 27) {//esc
if (key === 27) { //esc
this.close();
} else if (key === 39) { //right arrow
this.nextPage();
} else if (key === 37) {//left arrow
this.previousPage();
}
}