Improve the handling of the currentOutlineButton enabling/disabling (PR 12777 follow-up)

It's obviously better and more correct to handle the "pagesloaded" case within `PDFOutlineViewer` *itself*, rather than essentially splitting the logic in two parts and forcing `PDFSidebar` to deal with what should've been handled internally in `PDFOutlineViewer`.

This is what I *should* have done in PR	12777, but for some reason didn't figure out how to implement it well enough back then; sorry about the churn here!
This commit is contained in:
Jonas Jenwald 2021-04-10 12:52:53 +02:00
parent 05b0798824
commit 27062f72c2
2 changed files with 32 additions and 7 deletions

View file

@ -425,11 +425,12 @@ class PDFSidebar {
this.eventBus._on("outlineloaded", evt => {
onTreeLoaded(evt.outlineCount, this.outlineButton, SidebarView.OUTLINE);
if (evt.enableCurrentOutlineItemButton) {
this.pdfViewer.pagesPromise.then(() => {
this._currentOutlineItemButton.disabled = !this.isInitialViewSet;
});
}
evt.currentOutlineItemPromise.then(enabled => {
if (!this.isInitialViewSet) {
return;
}
this._currentOutlineItemButton.disabled = !enabled;
});
});
this.eventBus._on("attachmentsloaded", evt => {