Change page with keyboard.

--HG--
extra : rebase_source : 15d0fc7283e1cab0dcccfe1483d8085f0c2e3309
This commit is contained in:
Sébastien Lucas 2013-09-11 13:59:30 +02:00
parent ae900c4fb5
commit 7f74a172f6

View file

@ -41,6 +41,21 @@ Monocle.DEBUG = true;
'resize',
function () { window.reader.resized() }
);
Monocle.Events.listen(window.top.document, 'keyup', function(evt) {
var eventCharCode = evt.charCode || evt.keyCode;
var dir = null;
var flipper = reader.Flipper;
if (eventCharCode == 33 || eventCharCode == 37) { // Page down or Left arrow
dir = -1;
} else if (eventCharCode == 34 || eventCharCode == 39 ) { // Page down or Right arrow
dir = 1;
}
if (dir) {
reader.moveTo({ direction: dir });
evt.preventDefault();
}
});
/* MAGNIFIER CONTROL */
var magnifier = new Monocle.Controls.Magnifier(reader);