function order
This commit is contained in:
parent
c02932d9aa
commit
1e55f3dc39
1 changed files with 32 additions and 32 deletions
|
@ -460,38 +460,6 @@ function ComicBook(id, srcs, opts) {
|
||||||
|
|
||||||
this.showControl("loadingOverlay");
|
this.showControl("loadingOverlay");
|
||||||
|
|
||||||
// loads pages in both directions so you don't have to wait for all pages
|
|
||||||
// to be loaded before you can scroll backwards
|
|
||||||
function preload(start, stop) {
|
|
||||||
|
|
||||||
var forward_buffer = 3; // TODO: make this into a config option?
|
|
||||||
|
|
||||||
var j = 0;
|
|
||||||
var count = 1;
|
|
||||||
var forward = start;
|
|
||||||
var backward = start-1;
|
|
||||||
|
|
||||||
while (forward <= stop) {
|
|
||||||
|
|
||||||
if (count > forward_buffer && backward > -1) {
|
|
||||||
queue.push(backward);
|
|
||||||
backward--;
|
|
||||||
count = 0;
|
|
||||||
} else {
|
|
||||||
queue.push(forward);
|
|
||||||
forward++;
|
|
||||||
}
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (backward > -1) {
|
|
||||||
queue.push(backward);
|
|
||||||
backward--;
|
|
||||||
}
|
|
||||||
|
|
||||||
loadImage(queue[j]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadImage(i) {
|
function loadImage(i) {
|
||||||
|
|
||||||
var page = new Image();
|
var page = new Image();
|
||||||
|
@ -532,6 +500,38 @@ function ComicBook(id, srcs, opts) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// loads pages in both directions so you don't have to wait for all pages
|
||||||
|
// to be loaded before you can scroll backwards
|
||||||
|
function preload(start, stop) {
|
||||||
|
|
||||||
|
var forward_buffer = 3; // TODO: make this into a config option?
|
||||||
|
|
||||||
|
var j = 0;
|
||||||
|
var count = 1;
|
||||||
|
var forward = start;
|
||||||
|
var backward = start-1;
|
||||||
|
|
||||||
|
while (forward <= stop) {
|
||||||
|
|
||||||
|
if (count > forward_buffer && backward > -1) {
|
||||||
|
queue.push(backward);
|
||||||
|
backward--;
|
||||||
|
count = 0;
|
||||||
|
} else {
|
||||||
|
queue.push(forward);
|
||||||
|
forward++;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (backward > -1) {
|
||||||
|
queue.push(backward);
|
||||||
|
backward--;
|
||||||
|
}
|
||||||
|
|
||||||
|
loadImage(queue[j]);
|
||||||
|
}
|
||||||
|
|
||||||
preload(i, srcs.length-1);
|
preload(i, srcs.length-1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue