mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
fix image width/height for zoomed viewport
image width/height is off while pdf is zoomed, use raw transform values to compute width/height to fix this.
This commit is contained in:
parent
c40c594999
commit
c33b92036f
1 changed files with 4 additions and 6 deletions
|
@ -1286,15 +1286,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||||
0, -h, w, h);
|
0, -h, w, h);
|
||||||
if (this.imageLayer) {
|
if (this.imageLayer) {
|
||||||
var currentTransform = ctx.mozCurrentTransformInverse;
|
var currentTransform = ctx.mozCurrentTransformInverse;
|
||||||
var widthScale = Math.max(Math.abs(currentTransform[0]), 1);
|
|
||||||
var heightScale = Math.max(Math.abs(currentTransform[3]), 1);
|
|
||||||
var position = this.getCanvasPosition(0, 0);
|
var position = this.getCanvasPosition(0, 0);
|
||||||
this.imageLayer.appendImage({
|
this.imageLayer.appendImage({
|
||||||
objId: objId,
|
objId: objId,
|
||||||
left: position[0],
|
left: position[0],
|
||||||
top: position[1],
|
top: position[1],
|
||||||
width: w / widthScale,
|
width: w / currentTransform[0],
|
||||||
height: h / heightScale
|
height: h / currentTransform[3]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.restore();
|
this.restore();
|
||||||
|
@ -1402,8 +1400,8 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
|
||||||
imgData: imgData,
|
imgData: imgData,
|
||||||
left: position[0],
|
left: position[0],
|
||||||
top: position[1],
|
top: position[1],
|
||||||
width: width / widthScale,
|
width: width / currentTransform[0],
|
||||||
height: height / heightScale
|
height: height / currentTransform[3]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.restore();
|
this.restore();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue