draw a specific page number

This commit is contained in:
Bala Clark 2011-09-03 21:55:45 +02:00
parent f163b7ba6e
commit 2f34a49483

View file

@ -479,14 +479,24 @@ function ComicBook(id, srcs, opts) {
// manually trigger the first load // manually trigger the first load
preload(i); preload(i);
}; };
ComicBook.prototype.pageLoaded = function (page_no) {
return (typeof loaded[page_no-1] !== "undefined");
};
/** /**
* Draw the current page in the canvas * Draw the current page in the canvas
*
* TODO: break this down into drawSinglePage() & drawDoublePage()?
* TODO: if the current browser doesn't have canvas support, use img tags
*/ */
ComicBook.prototype.drawPage = function() { ComicBook.prototype.drawPage = function(page_no) {
// if a specific page is given try to render it, if not bail and wait for preload() to render it
if (typeof page_no === "number" && page_no < srcs.length) {
pointer = page_no-1;
if (!this.pageLoaded(page_no)) {
this.showControl("loadingIndicator");
return;
}
}
var zoom_scale; var zoom_scale;
var offsetW = 0, offsetH = 0; var offsetW = 0, offsetH = 0;