mirror of
https://github.com/konvajs/konva.git
synced 2025-11-24 16:53:06 +08:00
Merge pull request #531 from VladimirTechMan/master
Do not recalculate additionalWidth on every line of multiline text
This commit is contained in:
@@ -356,11 +356,11 @@ export class Text extends Shape {
|
|||||||
|
|
||||||
this.textArr = [];
|
this.textArr = [];
|
||||||
getDummyContext().font = this._getContextFont();
|
getDummyContext().font = this._getContextFont();
|
||||||
|
var additionalWidth = shouldAddEllipsis
|
||||||
|
? this._getTextWidth(ELLIPSIS)
|
||||||
|
: 0;
|
||||||
for (var i = 0, max = lines.length; i < max; ++i) {
|
for (var i = 0, max = lines.length; i < max; ++i) {
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
var additionalWidth = shouldAddEllipsis
|
|
||||||
? this._getTextWidth(ELLIPSIS)
|
|
||||||
: 0;
|
|
||||||
|
|
||||||
var lineWidth = this._getTextWidth(line);
|
var lineWidth = this._getTextWidth(line);
|
||||||
if (fixedWidth && lineWidth > maxWidth) {
|
if (fixedWidth && lineWidth > maxWidth) {
|
||||||
|
|||||||
Reference in New Issue
Block a user