Improve how we disable PDFThumbnailView.setImage for documents with Optional Content (PR 12170 follow-up)

Rather than always disable `PDFThumbnailView.setImage` as soon as user has changed the visibility of the Optional Content, we can utilize the new method added in the previous patch to improve thumbnail performance. Note in particular how, in the old code, even *resetting* of the Optional Content to its default state wouldn't enable `PDFThumbnailView.setImage` again.

While slightly unrelated, this patch also removes the `PDFThumbnailViewer._optionalContentConfigPromise`-property since it's completely unused.
This commit is contained in:
Jonas Jenwald 2022-07-24 13:14:58 +02:00
parent ceb4f8a6ab
commit 3446f15bf3
4 changed files with 38 additions and 25 deletions

View file

@ -1824,6 +1824,7 @@ class BaseViewer {
return Promise.resolve(null);
}
if (!this._optionalContentConfigPromise) {
console.error("optionalContentConfigPromise: Not initialized yet.");
// Prevent issues if the getter is accessed *before* the `onePageRendered`
// promise has resolved; won't (normally) happen in the default viewer.
return this.pdfDocument.getOptionalContentConfig();