Skip to content

Commit 53c14df

Browse files
committed
Changing any aspect of a Text object, such as the font size or content, wouldn't update its hitArea if it had been enabled for input, causing it to carry on using the old hit area size. Now, as long as the Text was created _without_ a custom hitArea, the hitArea size will be changed to match the new texture size on update. If you have provided your own custom hitArea shape, you need to modify it when the Text changes size yourself. Fix phaserjs#4456
1 parent 94b7db0 commit 53c14df

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/gameobjects/text/static/Text.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,14 @@ var Text = new Class({
12371237

12381238
this.dirty = true;
12391239

1240+
var input = this.input;
1241+
1242+
if (input && !input.customHitArea)
1243+
{
1244+
input.hitArea.width = this.width;
1245+
input.hitArea.height = this.height;
1246+
}
1247+
12401248
return this;
12411249
},
12421250

0 commit comments

Comments
 (0)