Skip to content

Commit

Permalink
Merge pull request #19622 from nicolo-ribaudo/zoom-detail-view-consta…
Browse files Browse the repository at this point in the history
…nt-redraw

Do not constantly render the detail canvas on zoom (bug 1952496)
  • Loading branch information
Snuffleupagus authored Mar 7, 2025
2 parents af89e77 + a1dc46a commit cef4fcf
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions web/pdf_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1868,14 +1868,18 @@ class PDFViewer {
this._spreadMode !== SpreadMode.NONE &&
this._scrollMode !== ScrollMode.HORIZONTAL;

// If we are scrolling and the rendering of a detail view was just
// cancelled, it's because the user is scrolling too quickly and so
// we constantly need to re-render a different area.
// Don't attempt to re-render it: this will be done once the user
// stops scrolling.
const ignoreDetailViews =
this.#scrollTimeoutId !== null &&
visiblePages.views.some(page => page.detailView?.renderingCancelled);
// If we are zooming, do not re-render the detail views. Re-renders on
// zoom happen with a delay, and once the rendering happens it will also
// trigger rendering of the detail views.
this.#scaleTimeoutId !== null ||
// If we are scrolling and the rendering of a detail view was just
// cancelled, it's because the user is scrolling too quickly and so
// we constantly need to re-render a different area.
// Don't attempt to re-render it: this will be done once the user
// stops scrolling.
(this.#scrollTimeoutId !== null &&
visiblePages.views.some(page => page.detailView?.renderingCancelled));

const pageView = this.renderingQueue.getHighestPriority(
visiblePages,
Expand Down

0 comments on commit cef4fcf

Please sign in to comment.