div.removeAttribute('data-loaded');
delete this.canvas;
+
+ this.loadingIconDiv = document.createElement('div');
+ this.loadingIconDiv.className = 'loadingIcon';
+ div.appendChild(this.loadingIconDiv);
};
function setupAnnotations(content, scale) {
};
this.drawingRequired = function() {
- return !div.hasChildNodes();
+ return !div.querySelector('canvas');
};
this.draw = function pageviewDraw(callback) {
div.appendChild(canvas);
this.canvas = canvas;
- var loadingIconDiv = document.createElement('div');
- loadingIconDiv.className = 'loadingIcon';
- div.appendChild(loadingIconDiv);
-
var textLayerDiv = null;
if (!PDFJS.disableTextLayer) {
textLayerDiv = document.createElement('div');
// Rendering area
var self = this;
-
- // Display loading icon if page hasn't finished rendering after XXXX ms
- var loadingTimer = setTimeout(function loadingTimerCallback() {
- loadingIconDiv.classList.add('show');
- }, 1000);
-
stats.begin = Date.now();
this.content.startRendering(ctx, function pageViewDrawCallback(error) {
- clearTimeout(loadingTimer);
- loadingIconDiv.classList.remove('show');
+ self.loadingIconDiv.classList.add('hide');
if (error)
PDFView.error('An error occurred while rendering the page.', error);