mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
Ignore too small page-canvases in PDFThumbnailView.setImage
It doesn't make sense to use a page-canvas that's *smaller* than the resulting thumbnail, since that causes the image to be upscaled which results in a blurry thumbnail. Note that this doesn't normally happen, unless a very small zoom-level is used in the viewer.
This commit is contained in:
parent
b8aa9c6221
commit
5b50a50559
1 changed files with 5 additions and 1 deletions
|
@ -352,13 +352,17 @@ class PDFThumbnailView {
|
||||||
if (this.renderingState !== RenderingStates.INITIAL) {
|
if (this.renderingState !== RenderingStates.INITIAL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const { thumbnailCanvas: canvas, pdfPage } = pageView;
|
const { thumbnailCanvas: canvas, pdfPage, scale } = pageView;
|
||||||
if (!canvas) {
|
if (!canvas) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.pdfPage) {
|
if (!this.pdfPage) {
|
||||||
this.setPdfPage(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.renderingState = RenderingStates.FINISHED;
|
||||||
this._convertCanvasToImage(canvas);
|
this._convertCanvasToImage(canvas);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue