Tweak the "pagesloaded" event handler in PDFOutlineViewer
These changes improves the consistency ever so slightly in the `PDFOutlineViewer._dispatchEvent` method, by making sure that we can tell the following two cases apart: - The "pagesloaded" event has *not yet* been fired. - The "pagesloaded" event has been fired, but no pages were available.
This commit is contained in:
parent
9de30c4ff0
commit
e027178356
@ -72,7 +72,7 @@ class PDFOutlineViewer extends BaseTreeViewer {
|
|||||||
|
|
||||||
this._pageNumberToDestHashCapability = null;
|
this._pageNumberToDestHashCapability = null;
|
||||||
this._currentPageNumber = 1;
|
this._currentPageNumber = 1;
|
||||||
this._isPagesLoaded = false;
|
this._isPagesLoaded = null;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this._currentOutlineItemCapability &&
|
this._currentOutlineItemCapability &&
|
||||||
@ -93,8 +93,10 @@ class PDFOutlineViewer extends BaseTreeViewer {
|
|||||||
this._pdfDocument?.loadingParams.disableAutoFetch
|
this._pdfDocument?.loadingParams.disableAutoFetch
|
||||||
) {
|
) {
|
||||||
this._currentOutlineItemCapability.resolve(/* enabled = */ false);
|
this._currentOutlineItemCapability.resolve(/* enabled = */ false);
|
||||||
} else if (this._isPagesLoaded) {
|
} else if (this._isPagesLoaded !== null) {
|
||||||
this._currentOutlineItemCapability.resolve(/* enabled = */ true);
|
this._currentOutlineItemCapability.resolve(
|
||||||
|
/* enabled = */ this._isPagesLoaded
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventBus.dispatch("outlineloaded", {
|
this.eventBus.dispatch("outlineloaded", {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user