moved window.scroll to the draw method so that it is always called regardless of the navigation method

This commit is contained in:
Bala Clark 2011-09-03 22:04:38 +02:00
parent 727df8891e
commit a38ff55da0

View file

@ -445,7 +445,7 @@ function ComicBook(id, srcs, opts) {
pages[i] = this; pages[i] = this;
loaded.push(i); loaded.push(i);
// start to load from the begining if loading started midway // start to load from the beginning if loading started midway
if (i === no_pages-1 && loaded.length !== no_pages) { if (i === no_pages-1 && loaded.length !== no_pages) {
i = -1; i = -1;
} }
@ -458,6 +458,7 @@ function ComicBook(id, srcs, opts) {
//console.log(loaded[loaded.length-1]); //console.log(loaded[loaded.length-1]);
// double page mode needs an extra page added to the buffer
padding = (options.displayMode === "double") ? 1 : 0; padding = (options.displayMode === "double") ? 1 : 0;
// start rendering the comic when the buffer level has been reached (FIXME: buggy, fails if trying to load the last couple of pages) // start rendering the comic when the buffer level has been reached (FIXME: buggy, fails if trying to load the last couple of pages)
@ -606,6 +607,9 @@ function ComicBook(id, srcs, opts) {
if (getHash() !== pointer) { if (getHash() !== pointer) {
setHash(pointer + 1); setHash(pointer + 1);
} }
// make sure the top of the page is in view
window.scroll(0, 0);
}; };
/** /**
@ -778,8 +782,6 @@ function ComicBook(id, srcs, opts) {
e.stopPropagation(); e.stopPropagation();
window.scroll(0, 0); // make sure the top of the page is in view
// western style (left to right) // western style (left to right)
if (!options.manga) { if (!options.manga) {
if (side === "left") { ComicBook.prototype.drawPrevPage(); } if (side === "left") { ComicBook.prototype.drawPrevPage(); }