Extract common functionality into a new BaseTreeViewer._finishRendering method

Note how the end of the `{PDFOutlineViewer, PDFAttachmentViewer, PDFLayerViewer}.render` methods share *almost* identical code, hence we can reduce some duplication by introducing the new `BaseTreeViewer` helper method here.

Furthermore, setting `this._lastToggleIsShow` can be made ever so slightly more efficient, since we don't care about the number of ".treeItemsHidden"-classes but only want to know if at least one exists.
This commit is contained in:
Jonas Jenwald 2020-12-28 14:42:47 +01:00
parent 57bec090ae
commit 03f10739d8
4 changed files with 17 additions and 21 deletions

View file

@ -174,16 +174,8 @@ class PDFLayerViewer extends BaseTreeViewer {
levelData.parent.appendChild(div);
}
}
if (hasAnyNesting) {
this.container.classList.add("treeWithDeepNesting");
this._lastToggleIsShow =
fragment.querySelectorAll(".treeItemsHidden").length === 0;
}
this.container.appendChild(fragment);
this._dispatchEvent(layersCount);
this._finishRendering(fragment, layersCount, hasAnyNesting);
}
/**