Skip to content

Commit 935a893

Browse files
committed
Calling setText on a BitmapText object will now recalculate its display origin values. Fix phaserjs#3350
1 parent 458880b commit 935a893

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* A Scene can now be restarted by calling `scene.start()` and providing no arguments (thanks @migiyubi)
2020
* The class GameObject has now been exposed, available via `Phaser.GameObjects.GameObject` (thanks @rexrainbow)
2121
* A Camera following a Game Object will now take the zoom factor of the camera into consideration when scrolling. Fix #3353 (thanks @brandonvdongen)
22+
* Calling `setText` on a BitmapText object will now recalculate its display origin values. Fix #3350 (thanks @migiyubi)
2223

2324
## Version 3.2.0 - Kaori - 5th March 2018
2425

src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ var DynamicBitmapText = new Class({
245245
if (value !== this.text)
246246
{
247247
this.text = value.toString();
248+
249+
this.updateDisplayOrigin();
248250
}
249251

250252
return this;

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ var BitmapText = new Class({
164164
if (value !== this.text)
165165
{
166166
this.text = value.toString();
167+
168+
this.updateDisplayOrigin();
167169
}
168170

169171
return this;
@@ -216,6 +218,7 @@ var BitmapText = new Class({
216218
get: function ()
217219
{
218220
this.getTextBounds(false);
221+
219222
return this._bounds.global.width;
220223
}
221224

@@ -233,6 +236,7 @@ var BitmapText = new Class({
233236
get: function ()
234237
{
235238
this.getTextBounds(false);
239+
236240
return this._bounds.global.height;
237241
}
238242

0 commit comments

Comments
 (0)