Skip to content

Commit 97b60ef

Browse files
committed
Set canvas size equal to text object size
Canvas size might less than text object size, when `fixedWidth` and `fixedHeight` is set.
1 parent 8e4632f commit 97b60ef

1 file changed

Lines changed: 4 additions & 14 deletions

File tree

src/gameobjects/text/static/Text.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,12 +1118,9 @@ var Text = new Class({
11181118

11191119
var padding = this.padding;
11201120

1121-
var w = textSize.width + padding.left + padding.right;
1122-
var h = textSize.height + padding.top + padding.bottom;
1123-
11241121
if (style.fixedWidth === 0)
11251122
{
1126-
this.width = w;
1123+
this.width = textSize.width + padding.left + padding.right;
11271124
}
11281125
else
11291126
{
@@ -1132,22 +1129,15 @@ var Text = new Class({
11321129

11331130
if (style.fixedHeight === 0)
11341131
{
1135-
this.height = h;
1132+
this.height = textSize.height + padding.top + padding.bottom;
11361133
}
11371134
else
11381135
{
11391136
this.height = style.fixedHeight;
11401137
}
11411138

1142-
if (w > this.width)
1143-
{
1144-
w = this.width;
1145-
}
1146-
1147-
if (h > this.height)
1148-
{
1149-
h = this.height;
1150-
}
1139+
var w = this.width;
1140+
var h = this.height;
11511141

11521142
this.updateDisplayOrigin();
11531143

0 commit comments

Comments
 (0)