From 91f9948df425cfd5d63266b51901568a549a2145 Mon Sep 17 00:00:00 2001 From: Mack Duan Date: Tue, 23 Apr 2013 10:00:31 -0700 Subject: [PATCH] Only update progress bar if it increases --- web/viewer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/viewer.js b/web/viewer.js index ab743cd22..51857a672 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -110,6 +110,7 @@ var ProgressBar = (function ProgressBarClosure() { // Initialize heights this.div.style.height = this.height + this.units; + this.percent = 0; } ProgressBar.prototype = { @@ -1333,7 +1334,13 @@ var PDFView = { progress: function pdfViewProgress(level) { var percent = Math.round(level * 100); - PDFView.loadingBar.percent = percent; + // When we transition from full request to range requests, it's possible + // that we discard some of the loaded data. This can cause the loading + // bar to move backwards. So prevent this by only updating the bar if it + // increases. + if (percent > PDFView.loadingBar.percent) { + PDFView.loadingBar.percent = percent; + } }, load: function pdfViewLoad(pdfDocument, scale) {