Skip to content

Commit 7e2f228

Browse files
committed
Fix detail view blender page sizing
1 parent a10ce64 commit 7e2f228

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/display/blender/blender.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ class Blender {
290290
return this.origDrawImage(...args);
291291
}
292292

293-
const pageWidth = this.ctx.canvas.width;
294-
const pageHeight = this.ctx.canvas.height;
293+
const pageWidth = this.pageWidth || this.ctx.canvas.width;
294+
const pageHeight = this.pageHeight || this.ctx.canvas.height;
295295

296296
const { width, height } = this.getTransformedBoundingBox(this.ctx, dx, dy, dWidth, dHeight);
297297
const entirePage = Math.abs(pageWidth * pageHeight - width * height) < pageWidth * pageHeight * 0.25;

src/display/canvas.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,10 @@ class CanvasGraphics {
720720

721721
if (typeof window !== 'undefined' && window.theme && !this.ctx.skipBlender) {
722722
this.blender = new Blender(this.ctx, window.theme);
723+
this.blender.pageWidth =
724+
viewport.width * Math.abs(transform ? transform[0] : 1);
725+
this.blender.pageHeight =
726+
viewport.height * Math.abs(transform ? transform[3] : 1);
723727
}
724728
// For pdfs that use blend modes we have to clear the canvas else certain
725729
// blend modes can look wrong since we'd be blending with a white

0 commit comments

Comments
 (0)