mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 14:38:30 +00:00
The BitmapText.getTextBounds
method was being called every frame, even if the bounds didn't change, potentially costing a lot of CPU depending on the text length and quantity of them. It now only updates the bounds if they change.
This commit is contained in:
parent
ffc180c14d
commit
841389628e
1 changed files with 3 additions and 5 deletions
|
@ -358,7 +358,7 @@ var BitmapText = new Class({
|
|||
* @method Phaser.GameObjects.BitmapText#getTextBounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {boolean} [round] - Whether to round the results to the nearest integer.
|
||||
* @param {boolean} [round=false] - Whether to round the results up to the nearest integer.
|
||||
*
|
||||
* @return {Phaser.Types.GameObjects.BitmapText.BitmapTextSize} An object that describes the size of this Bitmap Text.
|
||||
*/
|
||||
|
@ -372,10 +372,10 @@ var BitmapText = new Class({
|
|||
|
||||
if (this._dirty || this.scaleX !== bounds.scaleX || this.scaleY !== bounds.scaleY)
|
||||
{
|
||||
GetBitmapTextSize(this, round, bounds);
|
||||
|
||||
this._dirty = false;
|
||||
|
||||
GetBitmapTextSize(this, round, bounds);
|
||||
|
||||
this.updateDisplayOrigin();
|
||||
}
|
||||
|
||||
|
@ -396,8 +396,6 @@ var BitmapText = new Class({
|
|||
this._displayOriginX = this.originX * this.width;
|
||||
this._displayOriginY = this.originY * this.height;
|
||||
|
||||
this._dirty = true;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue