mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 01:10:08 +02:00
Re-factor updating of thumbnails in the PDFSidebar
-class
This patch does two things: - Moves the updating of thumbnails into `web/app.js`, via a new `PDFSidebar` callback-function, to avoid having to include otherwise unnecessary parameters when initializing a `PDFSidebar`-instance. - Only attempt to generate thumbnail-images from pages that are *cached* in the viewer. Note that only pages that exist in the `PDFPageViewBuffer`-instance can be rendered, hence it's not actually meaningful to check every single page when updating the thumbnails. For large documents, with thousands of pages, this should be a tiny bit more efficient when e.g. opening the sidebar since we no longer need to check pages that we know have not been rendered.
This commit is contained in:
parent
0e604f8f42
commit
c4c8227d20
3 changed files with 22 additions and 27 deletions
|
@ -341,6 +341,10 @@ class PDFViewer {
|
|||
return this._pages[index];
|
||||
}
|
||||
|
||||
getCachedPageViews() {
|
||||
return new Set(this.#buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {boolean} - True if all {PDFPageView} objects are initialized.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue