Avoiding double draw() calls

This commit is contained in:
Yury Delendik 2014-01-07 10:59:54 -06:00
parent c1c15ac635
commit 378c49c2d8

View File

@ -414,12 +414,17 @@ var PageView = function pageView(container, id, scale,
this.draw = function pageviewDraw(callback) {
var pdfPage = this.pdfPage;
if (this.pagePdfPromise) {
return;
}
if (!pdfPage) {
var promise = PDFView.getPage(this.id);
promise.then(function(pdfPage) {
delete this.pagePdfPromise;
this.setPdfPage(pdfPage);
this.draw(callback);
}.bind(this));
this.pagePdfPromise = promise;
return;
}