This commit is contained in:
pandamicro
2018-07-17 16:46:02 +08:00
parent 83e9630333
commit 69166aef92
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -417,7 +417,7 @@ module.exports = {
_measureText (ctx) {
return function (string) {
return TextUtils.measureText(ctx, string);
return TextUtils.safeMeasureText(ctx, string);
};
},
+1 -1
View File
@@ -227,7 +227,7 @@ var TextUtils = {
return ((ch >= 9 && ch <= 13) || ch === 32 || ch === 133 || ch === 160 || ch === 5760 || (ch >= 8192 && ch <= 8202) || ch === 8232 || ch === 8233 || ch === 8239 || ch === 8287 || ch === 12288);
},
safeMeasureText = function (ctx, string) {
safeMeasureText: function (ctx, string) {
var metric = ctx.measureText(string);
return metric && metric.width || 0;
},