1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00
Scroll pages with alt-page up/down, not page up/down.

Implement screen scrolling for page up/down.

Fix comment about which key is up (code was right, but comments were inverted :D)
This commit is contained in:
Daniel Bonniot 2013-07-03 11:34:28 +02:00
parent d9bd8106fe
commit 4bde91423d

View File

@ -331,20 +331,37 @@ var pdf2htmlEX = (function(){
$(window).on('keydown', function keydown(e) { $(window).on('keydown', function keydown(e) {
switch (e.keyCode) { switch (e.keyCode) {
case 33: // Page Down case 33: // Page UP:
_.scroll_to_page(_.get_prev_page()); // pageup -> scroll one screen up
// alt-pageup -> scroll one page up
if (e.altKey) {
_.scroll_to_page(_.get_prev_page());
}
else {
_.$container.scrollTop(_.$container.scrollTop()-_.$container.height());
}
e.preventDefault(); e.preventDefault();
break; break;
case 34: // Page Up
_.scroll_to_page(_.get_next_page()); case 34: // Page DOWN
// pagedown -> scroll one screen down
// alt-pagedown -> scroll one page down
if (e.altKey) {
_.scroll_to_page(_.get_next_page());
}
else {
_.$container.scrollTop(_.$container.scrollTop()+_.$container.height());
}
e.preventDefault(); e.preventDefault();
break; break;
case 35: // End case 35: // End
if (e.ctrlKey) { if (e.ctrlKey) {
_.scroll_to_page(_.pages[_.pages.length-1]); _.scroll_to_page(_.pages[_.pages.length-1]);
e.preventDefault(); e.preventDefault();
} }
break; break;
case 36: // Home case 36: // Home
if (e.ctrlKey) { if (e.ctrlKey) {
_.scroll_to_page(_.pages[1]); _.scroll_to_page(_.pages[1]);