Skip to content

Commit 40929a5

Browse files
committed
Calling getTextBounds on a BitmapText object would return the incorrect values if the origin had been changed, but the text itself had not, as it was using out of date dimensions. Changing the origin now automatically triggers BitmapText to be dirty, forcing the bounds to be refreshed. Fix phaserjs#5121
1 parent 64c58bc commit 40929a5

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,25 @@ var BitmapText = new Class({
382382
return bounds;
383383
},
384384

385+
/**
386+
* Updates the Display Origin cached values internally stored on this Game Object.
387+
* You don't usually call this directly, but it is exposed for edge-cases where you may.
388+
*
389+
* @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin
390+
* @since 3.0.0
391+
*
392+
* @return {this} This Game Object instance.
393+
*/
394+
updateDisplayOrigin: function ()
395+
{
396+
this._displayOriginX = this.originX * this.width;
397+
this._displayOriginY = this.originY * this.height;
398+
399+
this._dirty = true;
400+
401+
return this;
402+
},
403+
385404
/**
386405
* Changes the font this BitmapText is using to render.
387406
*

0 commit comments

Comments
 (0)