Hide the struct tree layer during zooming

This commit is contained in:
Calixte Denizet 2023-02-07 14:38:32 +01:00
parent 05d821e680
commit 5bd352f69b
3 changed files with 19 additions and 0 deletions

View File

@ -417,6 +417,7 @@ class PDFPageView {
if (treeDom) {
this.canvas?.append(treeDom);
}
this.structTreeLayer?.show();
}
async #buildXfaTextContentItems(textDivs) {
@ -505,6 +506,7 @@ class PDFPageView {
if (textLayerNode) {
this.textLayer.hide();
}
this.structTreeLayer?.hide();
if (!zoomLayerNode) {
if (this.canvas) {
@ -776,6 +778,7 @@ class PDFPageView {
if (this.textLayer) {
if (hideTextLayer) {
this.textLayer.hide();
this.structTreeLayer?.hide();
} else if (redrawTextLayer) {
this.#renderTextLayer();
}

View File

@ -149,6 +149,10 @@
display: block;
}
.pdfViewer .page canvas .structTree {
contain: strict;
}
.pdfViewer .page canvas[hidden] {
display: none;
}

View File

@ -87,6 +87,18 @@ class StructTreeLayerBuilder {
return (this.#treeDom = treeDom);
}
hide() {
if (this.#treeDom && !this.#treeDom.hidden) {
this.#treeDom.hidden = true;
}
}
show() {
if (this.#treeDom?.hidden) {
this.#treeDom.hidden = false;
}
}
#setAttributes(structElement, htmlElement) {
if (structElement.alt !== undefined) {
htmlElement.setAttribute("aria-label", structElement.alt);