Fix cropping of canvas for float sized elements

This commit is contained in:
Niklas von Hertzen 2013-08-06 19:15:46 +03:00
parent 9a57a08c72
commit 056953f2c1

View File

@ -108,8 +108,8 @@ _html2canvas.Renderer.Canvas = function(options) {
// crop image to the bounds of selected (single) element // crop image to the bounds of selected (single) element
bounds = _html2canvas.Util.Bounds(options.elements[0]); bounds = _html2canvas.Util.Bounds(options.elements[0]);
newCanvas = document.createElement('canvas'); newCanvas = document.createElement('canvas');
newCanvas.width = bounds.width; newCanvas.width = Math.ceil(bounds.width);
newCanvas.height = bounds.height; newCanvas.height = Math.ceil(bounds.height);
ctx = newCanvas.getContext("2d"); ctx = newCanvas.getContext("2d");
ctx.drawImage(canvas, bounds.left, bounds.top, bounds.width, bounds.height, 0, 0, bounds.width, bounds.height); ctx.drawImage(canvas, bounds.left, bounds.top, bounds.width, bounds.height, 0, 0, bounds.width, bounds.height);