Merge pull request #2715 from bit/fix_imageLayer_scale
fix image width/height for zoomed viewport
This commit is contained in:
commit
d2aad6f54a
@ -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…
Reference in New Issue
Block a user