Skip to content

Commit 91f9948

Browse files
committed
Only update progress bar if it increases
1 parent c5084d9 commit 91f9948

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

web/viewer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ var ProgressBar = (function ProgressBarClosure() {
110110

111111
// Initialize heights
112112
this.div.style.height = this.height + this.units;
113+
this.percent = 0;
113114
}
114115

115116
ProgressBar.prototype = {
@@ -1333,7 +1334,13 @@ var PDFView = {
13331334

13341335
progress: function pdfViewProgress(level) {
13351336
var percent = Math.round(level * 100);
1336-
PDFView.loadingBar.percent = percent;
1337+
// When we transition from full request to range requests, it's possible
1338+
// that we discard some of the loaded data. This can cause the loading
1339+
// bar to move backwards. So prevent this by only updating the bar if it
1340+
// increases.
1341+
if (percent > PDFView.loadingBar.percent) {
1342+
PDFView.loadingBar.percent = percent;
1343+
}
13371344
},
13381345

13391346
load: function pdfViewLoad(pdfDocument, scale) {

0 commit comments

Comments
 (0)