From a78a500e9df417d221e662d0625c001b96523f86 Mon Sep 17 00:00:00 2001 From: MoyuScript Date: Tue, 6 Aug 2013 19:15:46 +0300 Subject: [PATCH] Fix cropping of canvas for float sized elements --- src/renderers/Canvas.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderers/Canvas.js b/src/renderers/Canvas.js index 1a6045b..b198be2 100644 --- a/src/renderers/Canvas.js +++ b/src/renderers/Canvas.js @@ -108,8 +108,8 @@ _html2canvas.Renderer.Canvas = function(options) { // crop image to the bounds of selected (single) element bounds = _html2canvas.Util.Bounds(options.elements[0]); newCanvas = document.createElement('canvas'); - newCanvas.width = bounds.width; - newCanvas.height = bounds.height; + newCanvas.width = Math.ceil(bounds.width); + newCanvas.height = Math.ceil(bounds.height); ctx = newCanvas.getContext("2d"); ctx.drawImage(canvas, bounds.left, bounds.top, bounds.width, bounds.height, 0, 0, bounds.width, bounds.height);