keyboard shortcut for image control

This commit is contained in:
Bala Clark 2011-08-31 00:15:12 +02:00
parent 3539eeb052
commit 6df9ce23ab

View file

@ -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;