Skip to content

Commit

Permalink
Don't remove the loading icon from the DOM when a page is resetted
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Dec 14, 2022
1 parent 0fdac9b commit 3517994
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ class PDFPageView {
case annotationEditorLayerNode:
case xfaLayerNode:
case textLayerNode:
case this.loadingIconDiv:
continue;
}
node.remove();
Expand Down Expand Up @@ -473,20 +474,25 @@ class PDFPageView {
delete this.svg;
}

this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible";
if (!this.loadingIconDiv) {
this.loadingIconDiv = document.createElement("div");
this.loadingIconDiv.className = "loadingIcon notVisible";
this.loadingIconDiv.setAttribute("role", "img");
this.l10n.get("loading").then(msg => {
this.loadingIconDiv?.setAttribute("aria-label", msg);
});
div.append(this.loadingIconDiv);
} else {
this.toggleLoadingIconSpinner();
}

if (
(typeof PDFJSDev === "undefined" ||
PDFJSDev.test("!PRODUCTION || GENERIC")) &&
this._isStandalone
) {
this.toggleLoadingIconSpinner(/* viewVisible = */ true);
}
this.loadingIconDiv.setAttribute("role", "img");
this.l10n.get("loading").then(msg => {
this.loadingIconDiv?.setAttribute("aria-label", msg);
});
div.append(this.loadingIconDiv);
}

update({ scale = 0, rotation = null, optionalContentConfigPromise = null }) {
Expand Down Expand Up @@ -725,6 +731,7 @@ class PDFPageView {
return Promise.reject(new Error("pdfPage is not loaded"));
}

this.toggleLoadingIconSpinner(/* viewVisible = */ true);
this.renderingState = RenderingStates.RUNNING;

// Wrap the canvas so that if it has a CSS transform for high DPI the
Expand Down

0 comments on commit 3517994

Please sign in to comment.