Skip to content

Commit

Permalink
Merge pull request #15251 from Snuffleupagus/thumbnail-setImage-small
Browse files Browse the repository at this point in the history
Ignore too small page-canvases in `PDFThumbnailView.setImage`
  • Loading branch information
timvandermeij authored Jul 31, 2022
2 parents 7798252 + 5b50a50 commit f9c593d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/pdf_thumbnail_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,17 @@ class PDFThumbnailView {
if (this.renderingState !== RenderingStates.INITIAL) {
return;
}
const { thumbnailCanvas: canvas, pdfPage } = pageView;
const { thumbnailCanvas: canvas, pdfPage, scale } = pageView;
if (!canvas) {
return;
}
if (!this.pdfPage) {
this.setPdfPage(pdfPage);
}
if (scale < this.scale) {
// Avoid upscaling the image, since that makes the thumbnail look blurry.
return;
}
this.renderingState = RenderingStates.FINISHED;
this._convertCanvasToImage(canvas);
}
Expand Down

0 comments on commit f9c593d

Please sign in to comment.