From 044f1c9e074f71bede758f4ff0ac3d65d88042dc Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 31 Aug 2024 11:58:43 +0200 Subject: [PATCH] Shorten the code that inits `AnnotationEditorLayerBuilder` in the `web/pdf_page_view.js` file This code can now utilize logical OR assignment, which is ever so slightly shorter. --- web/pdf_page_view.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index ddeca8d0b..bfe3b4763 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -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 => {