Skip to content

Commit

Permalink
Fix cropping of canvas for float sized elements
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasvh committed Aug 6, 2013
1 parent 9a57a08 commit 056953f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/renderers/Canvas.js
Expand Up @@ -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);
Expand Down

0 comments on commit 056953f

Please sign in to comment.