Don't remove the loading icon from the DOM when a page is resetted

This commit is contained in:
Calixte Denizet 2022-12-14 18:13:09 +01:00
parent d90e62e806
commit 20037e9919

View File

@ -429,6 +429,7 @@ class PDFPageView {
case annotationEditorLayerNode:
case xfaLayerNode:
case textLayerNode:
case this.loadingIconDiv:
continue;
}
node.remove();
@ -472,8 +473,18 @@ 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")) &&
@ -481,11 +492,6 @@ class PDFPageView {
) {
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 }) {