From 7e7b728b5d7bfd0477a44f70a9afdd9a30cae221 Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Wed, 26 Mar 2014 22:29:04 +0100 Subject: [PATCH] Assign non-zero width/height to all rectangles (issue 4260) --- src/display/canvas.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/display/canvas.js b/src/display/canvas.js index bcb851640..5f5d04dd5 100644 --- a/src/display/canvas.js +++ b/src/display/canvas.js @@ -975,6 +975,13 @@ var CanvasGraphics = (function CanvasGraphicsClosure() { this.ctx.closePath(); }, rectangle: function CanvasGraphics_rectangle(x, y, width, height) { + if (width === 0) { + width = this.getSinglePixelWidth(); + } + if (height === 0) { + height = this.getSinglePixelWidth(); + } + this.ctx.rect(x, y, width, height); }, stroke: function CanvasGraphics_stroke(consumePath) {