Browse Source

Use at least 1x1 pixel canvas for groups.

Brendan Dahl 12 years ago
parent
commit
ecb04c8bbe
  1. 7
      src/canvas.js

7
src/canvas.js

@ -1422,9 +1422,10 @@ var CanvasGraphics = (function CanvasGraphicsClosure() {
group.bbox, group.bbox,
currentCtx.mozCurrentTransform); currentCtx.mozCurrentTransform);
// Use ceil in case we're between sizes so we don't create canvas that is // Use ceil in case we're between sizes so we don't create canvas that is
// too small. // too small and make the canvas at least 1x1 pixels.
var drawnWidth = Math.ceil(bounds[2] - bounds[0]); var drawnWidth = Math.max(Math.ceil(bounds[2] - bounds[0]), 1);
var drawnHeight = Math.ceil(bounds[3] - bounds[1]); var drawnHeight = Math.max(Math.ceil(bounds[3] - bounds[1]), 1);
var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight); var scratchCanvas = createScratchCanvas(drawnWidth, drawnHeight);
var groupCtx = scratchCanvas.getContext('2d'); var groupCtx = scratchCanvas.getContext('2d');
addContextCurrentTransform(groupCtx); addContextCurrentTransform(groupCtx);

Loading…
Cancel
Save