mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Pre-render *one* additional page when spreadModes are enabled
Please note that we (obviously) don't want to unconditionally pre-render more than one page all the time, since that could very easily lead to overall worse performance in some documents.[1] However, when spreadModes are enabled it does make sense to attempt to pre-render both of the pages of the next/previous spread. --- [1] Since it may cause pre-rendering to unnecessarily compete for parsing resources, on the worker-thread, with "regular" rendering.
This commit is contained in:
parent
fb6c807ba2
commit
e4794a678a
2 changed files with 19 additions and 6 deletions
|
@ -1250,10 +1250,16 @@ class BaseViewer {
|
|||
const scrollAhead = this._isScrollModeHorizontal
|
||||
? this.scroll.right
|
||||
: this.scroll.down;
|
||||
const preRenderExtra =
|
||||
this._scrollMode === ScrollMode.VERTICAL &&
|
||||
this._spreadMode !== SpreadMode.NONE &&
|
||||
!this.isInPresentationMode;
|
||||
|
||||
const pageView = this.renderingQueue.getHighestPriority(
|
||||
visiblePages,
|
||||
this._pages,
|
||||
scrollAhead
|
||||
scrollAhead,
|
||||
preRenderExtra
|
||||
);
|
||||
if (pageView) {
|
||||
this._ensurePdfPageLoaded(pageView).then(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue