mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Fix the positioning of the progressive loadingBar
This commit is contained in:
parent
af8e96cf26
commit
4890c5d017
3 changed files with 34 additions and 16 deletions
|
@ -746,16 +746,21 @@ var PDFView = {
|
|||
return support;
|
||||
},
|
||||
|
||||
get loadingBar() {
|
||||
var bar = new ProgressBar('#loadingBar', {});
|
||||
Object.defineProperty(this, 'loadingBar', { value: bar,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: false });
|
||||
return bar;
|
||||
},
|
||||
|
||||
get isHorizontalScrollbarEnabled() {
|
||||
var div = document.getElementById('viewerContainer');
|
||||
return div.scrollWidth > div.clientWidth;
|
||||
},
|
||||
|
||||
initPassiveLoading: function pdfViewInitPassiveLoading() {
|
||||
if (!PDFView.loadingBar) {
|
||||
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
|
||||
}
|
||||
|
||||
var pdfDataRangeTransport = {
|
||||
rangeListeners: [],
|
||||
progressListeners: [],
|
||||
|
@ -857,10 +862,6 @@ var PDFView = {
|
|||
}
|
||||
}
|
||||
|
||||
if (!PDFView.loadingBar) {
|
||||
PDFView.loadingBar = new ProgressBar('#loadingBar', {});
|
||||
}
|
||||
|
||||
this.pdfDocument = null;
|
||||
var self = this;
|
||||
self.loading = true;
|
||||
|
@ -1150,8 +1151,7 @@ var PDFView = {
|
|||
errorWrapper.setAttribute('hidden', 'true');
|
||||
|
||||
pdfDocument.dataLoaded().then(function() {
|
||||
var loadingBar = document.getElementById('loadingBar');
|
||||
loadingBar.classList.add('hidden');
|
||||
PDFView.loadingBar.hide();
|
||||
var outerContainer = document.getElementById('outerContainer');
|
||||
outerContainer.classList.remove('loadingInProgress');
|
||||
});
|
||||
|
@ -1213,6 +1213,8 @@ var PDFView = {
|
|||
event.initCustomEvent('documentload', true, true, {});
|
||||
window.dispatchEvent(event);
|
||||
|
||||
PDFView.loadingBar.setWidth(container);
|
||||
|
||||
for (var pageNum = 1; pageNum <= pagesCount; ++pageNum) {
|
||||
var pagePromise = pdfDocument.getPage(pageNum);
|
||||
pagePromise.then(function(pdfPage) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue