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 #5121

This commit is contained in:
Richard Davey 2020-07-13 14:06:06 +01:00
parent 64c58bc592
commit 40929a57e3

View file

@ -382,6 +382,25 @@ var BitmapText = new Class({
return bounds;
},
/**
* Updates the Display Origin cached values internally stored on this Game Object.
* You don't usually call this directly, but it is exposed for edge-cases where you may.
*
* @method Phaser.GameObjects.Components.Origin#updateDisplayOrigin
* @since 3.0.0
*
* @return {this} This Game Object instance.
*/
updateDisplayOrigin: function ()
{
this._displayOriginX = this.originX * this.width;
this._displayOriginY = this.originY * this.height;
this._dirty = true;
return this;
},
/**
* Changes the font this BitmapText is using to render.
*