From ecb04c8bbe4abb84d24865b9caa3062a5e06b278 Mon Sep 17 00:00:00 2001 From: Brendan Dahl Date: Thu, 11 Apr 2013 11:19:42 -0700 Subject: [PATCH] Use at least 1x1 pixel canvas for groups. --- src/canvas.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/canvas.js b/src/canvas.js index 6dd5b2b03..8ce8e6f1f 100644 --- a/src/canvas.js +++ b/src/canvas.js @@ -1422,9 +1422,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { group.bbox, currentCtx.mozCurrentTransform); // Use ceil in case we're between sizes so we don't create canvas that is - // too small. - var drawnWidth = Math.ceil(bounds[2] - bounds[0]); - var drawnHeight = Math.ceil(bounds[3] - bounds[1]); + // too small and make the canvas at least 1x1 pixels. + var drawnWidth = Math.max(Math.ceil(bounds[2] - bounds[0]), 1); + var drawnHeight = Math.max(Math.ceil(bounds[3] - bounds[1]), 1); + var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight); var groupCtx = scratchCanvas.getContext('2d'); addContextCurrentTransform(groupCtx);