Merge pull request #531 from VladimirTechMan/master

Do not recalculate additionalWidth on every line of multiline text
This commit is contained in:
Anton Lavrenov 2019-01-08 12:16:01 -05:00 committed by GitHub
commit 4571ea16b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -356,11 +356,11 @@ export class Text extends Shape {
this.textArr = [];
getDummyContext().font = this._getContextFont();
var additionalWidth = shouldAddEllipsis
? this._getTextWidth(ELLIPSIS)
: 0;
for (var i = 0, max = lines.length; i < max; ++i) {
var line = lines[i];
var additionalWidth = shouldAddEllipsis
? this._getTextWidth(ELLIPSIS)
: 0;
var lineWidth = this._getTextWidth(line);
if (fixedWidth && lineWidth > maxWidth) {