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: {}, enhance: {},
keyboard: { keyboard: {
next: 78, next: 78,
previous: 80 previous: 80,
control: {
image: 69
}
} }
}; };
@ -250,6 +253,14 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.hideControl = function(control) { ComicBook.prototype.hideControl = function(control) {
this.getControl(control).hide(); 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. * Get the image for a given page.
@ -592,8 +603,12 @@ function ComicBook(id, srcs, opts) {
side = getCursorPosition(e); side = getCursorPosition(e);
break; break;
case "keydown": case "keydown":
if (e.keyCode === options.keyboard.previous) { side = "left"; } if (e.keyCode === options.keyboard.previous) { side = "left"; }
if (e.keyCode === options.keyboard.next) { side = "right"; } if (e.keyCode === options.keyboard.next) { side = "right"; }
if (e.keyCode === options.keyboard.control.image) {
ComicBook.prototype.toggleControl("image");
}
break; break;
default: default:
throw "invalid navigation event: " + e.type; throw "invalid navigation event: " + e.type;