Skip to content

Commit

Permalink
Merge pull request #18672 from Snuffleupagus/PDFPageView-AnnotationEd…
Browse files Browse the repository at this point in the history
…itorLayerBuilder-shorter-init

Shorten the code that inits `AnnotationEditorLayerBuilder` in the `web/pdf_page_view.js` file
  • Loading branch information
timvandermeij authored Sep 1, 2024
2 parents 4a13222 + 044f1c9 commit bde7a84
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions web/pdf_page_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,27 +1078,24 @@ class PDFPageView {
if (!annotationEditorUIManager) {
return;
}

this.drawLayer ||= new DrawLayerBuilder({
pageIndex: this.id,
});
await this.#renderDrawLayer();
this.drawLayer.setParent(canvasWrapper);

if (!this.annotationEditorLayer) {
this.annotationEditorLayer = new AnnotationEditorLayerBuilder({
uiManager: annotationEditorUIManager,
pdfPage,
l10n,
accessibilityManager: this._accessibilityManager,
annotationLayer: this.annotationLayer?.annotationLayer,
textLayer: this.textLayer,
drawLayer: this.drawLayer.getDrawLayer(),
onAppend: annotationEditorLayerDiv => {
this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
},
});
}
this.annotationEditorLayer ||= new AnnotationEditorLayerBuilder({
uiManager: annotationEditorUIManager,
pdfPage,
l10n,
accessibilityManager: this._accessibilityManager,
annotationLayer: this.annotationLayer?.annotationLayer,
textLayer: this.textLayer,
drawLayer: this.drawLayer.getDrawLayer(),
onAppend: annotationEditorLayerDiv => {
this.#addLayer(annotationEditorLayerDiv, "annotationEditorLayer");
},
});
this.#renderAnnotationEditorLayer();
},
error => {
Expand Down

0 comments on commit bde7a84

Please sign in to comment.