Make the various layer-render methods, in PDFPageView
, properly private
This commit is contained in:
parent
e182597cb1
commit
5df341ed7e
@ -247,15 +247,12 @@ class PDFPageView {
|
|||||||
this.pdfPage?.cleanup();
|
this.pdfPage?.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
async #renderAnnotationLayer() {
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
async _renderAnnotationLayer() {
|
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
await this.annotationLayer.render(this.viewport, "display");
|
await this.annotationLayer.render(this.viewport, "display");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(`_renderAnnotationLayer: "${ex}".`);
|
console.error(`#renderAnnotationLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationlayerrendered", {
|
this.eventBus.dispatch("annotationlayerrendered", {
|
||||||
@ -266,15 +263,12 @@ class PDFPageView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
async #renderAnnotationEditorLayer() {
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
async _renderAnnotationEditorLayer() {
|
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
await this.annotationEditorLayer.render(this.viewport, "display");
|
await this.annotationEditorLayer.render(this.viewport, "display");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(`_renderAnnotationEditorLayer: "${ex}".`);
|
console.error(`#renderAnnotationEditorLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("annotationeditorlayerrendered", {
|
this.eventBus.dispatch("annotationeditorlayerrendered", {
|
||||||
@ -285,18 +279,15 @@ class PDFPageView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
async #renderXfaLayer() {
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
async _renderXfaLayer() {
|
|
||||||
let error = null;
|
let error = null;
|
||||||
try {
|
try {
|
||||||
const result = await this.xfaLayer.render(this.viewport, "display");
|
const result = await this.xfaLayer.render(this.viewport, "display");
|
||||||
if (result?.textDivs && this.textHighlighter) {
|
if (result?.textDivs && this.textHighlighter) {
|
||||||
this._buildXfaTextContentItems(result.textDivs);
|
this.#buildXfaTextContentItems(result.textDivs);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(`_renderXfaLayer: "${ex}".`);
|
console.error(`#renderXfaLayer: "${ex}".`);
|
||||||
error = ex;
|
error = ex;
|
||||||
} finally {
|
} finally {
|
||||||
this.eventBus.dispatch("xfalayerrendered", {
|
this.eventBus.dispatch("xfalayerrendered", {
|
||||||
@ -365,7 +356,7 @@ class PDFPageView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _buildXfaTextContentItems(textDivs) {
|
async #buildXfaTextContentItems(textDivs) {
|
||||||
const text = await this.pdfPage.getTextContent();
|
const text = await this.pdfPage.getTextContent();
|
||||||
const items = [];
|
const items = [];
|
||||||
for (const item of text.items) {
|
for (const item of text.items) {
|
||||||
@ -676,13 +667,13 @@ class PDFPageView {
|
|||||||
target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
|
target.style.transform = `rotate(${relativeRotation}deg) scale(${scaleX}, ${scaleY})`;
|
||||||
|
|
||||||
if (redrawAnnotationLayer && this.annotationLayer) {
|
if (redrawAnnotationLayer && this.annotationLayer) {
|
||||||
this._renderAnnotationLayer();
|
this.#renderAnnotationLayer();
|
||||||
}
|
}
|
||||||
if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {
|
if (redrawAnnotationEditorLayer && this.annotationEditorLayer) {
|
||||||
this._renderAnnotationEditorLayer();
|
this.#renderAnnotationEditorLayer();
|
||||||
}
|
}
|
||||||
if (redrawXfaLayer && this.xfaLayer) {
|
if (redrawXfaLayer && this.xfaLayer) {
|
||||||
this._renderXfaLayer();
|
this.#renderXfaLayer();
|
||||||
}
|
}
|
||||||
if (redrawTextLayer && this.textLayer) {
|
if (redrawTextLayer && this.textLayer) {
|
||||||
this.#renderTextLayer();
|
this.#renderTextLayer();
|
||||||
@ -851,7 +842,7 @@ class PDFPageView {
|
|||||||
this.#renderTextLayer();
|
this.#renderTextLayer();
|
||||||
|
|
||||||
if (this.annotationLayer) {
|
if (this.annotationLayer) {
|
||||||
this._renderAnnotationLayer().then(() => {
|
this.#renderAnnotationLayer().then(() => {
|
||||||
if (this.annotationEditorLayerFactory) {
|
if (this.annotationEditorLayerFactory) {
|
||||||
this.annotationEditorLayer ||=
|
this.annotationEditorLayer ||=
|
||||||
this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder(
|
this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder(
|
||||||
@ -862,7 +853,7 @@ class PDFPageView {
|
|||||||
accessibilityManager: this._accessibilityManager,
|
accessibilityManager: this._accessibilityManager,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this._renderAnnotationEditorLayer();
|
this.#renderAnnotationEditorLayer();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -878,7 +869,7 @@ class PDFPageView {
|
|||||||
pageDiv: div,
|
pageDiv: div,
|
||||||
pdfPage,
|
pdfPage,
|
||||||
});
|
});
|
||||||
this._renderXfaLayer();
|
this.#renderXfaLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
div.setAttribute("data-loaded", true);
|
div.setAttribute("data-loaded", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user