Avoid width=0 for text objects

This commit is contained in:
kangax 2013-10-25 09:03:10 +02:00
parent 476da71e92
commit f6a6ea68b7

View file

@ -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;