From f6a6ea68b7c2da3436821c535f7d5645f4756423 Mon Sep 17 00:00:00 2001 From: kangax Date: Fri, 25 Oct 2013 09:03:10 +0200 Subject: [PATCH] Avoid width=0 for text objects --- src/shapes/text.class.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shapes/text.class.js b/src/shapes/text.class.js index ff3e1a80..e3a0989c 100644 --- a/src/shapes/text.class.js +++ b/src/shapes/text.class.js @@ -463,7 +463,7 @@ * @return {Number} Maximum width of fabric.Text object */ _getTextWidth: function(ctx, textLines) { - var maxWidth = ctx.measureText(textLines[0]).width; + var maxWidth = ctx.measureText(textLines[0] || '|').width; for (var i = 1, len = textLines.length; i < len; i++) { var currentLineWidth = ctx.measureText(textLines[i]).width;