keyboard shortcut for image control
This commit is contained in:
parent
3539eeb052
commit
6df9ce23ab
1 changed files with 16 additions and 1 deletions
|
@ -52,7 +52,10 @@ function ComicBook(id, srcs, opts) {
|
|||
enhance: {},
|
||||
keyboard: {
|
||||
next: 78,
|
||||
previous: 80
|
||||
previous: 80,
|
||||
control: {
|
||||
image: 69
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -251,6 +254,14 @@ function ComicBook(id, srcs, opts) {
|
|||
this.getControl(control).hide();
|
||||
}
|
||||
|
||||
ComicBook.prototype.toggleControl = function(control) {
|
||||
if (this.getControl(control).is(":visible")) {
|
||||
this.hideControl(control);
|
||||
} else {
|
||||
this.showControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the image for a given page.
|
||||
*
|
||||
|
@ -592,8 +603,12 @@ function ComicBook(id, srcs, opts) {
|
|||
side = getCursorPosition(e);
|
||||
break;
|
||||
case "keydown":
|
||||
|
||||
if (e.keyCode === options.keyboard.previous) { side = "left"; }
|
||||
if (e.keyCode === options.keyboard.next) { side = "right"; }
|
||||
if (e.keyCode === options.keyboard.control.image) {
|
||||
ComicBook.prototype.toggleControl("image");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw "invalid navigation event: " + e.type;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue