Skip to content

Commit

Permalink
The BitmapText Game Object has two new read-only properties `displa…
Browse files Browse the repository at this point in the history
…yWidth` and `displayHeight`. This allows the BitmapText to correctly use the `GetBounds` component.

The `BitmapText` Game Object now has the `GetBounds` component added to it, meaning you can now correctly get its dimensions as part of a Container. Fix #6237
  • Loading branch information
photonstorm committed Nov 8, 2022
1 parent 4483f92 commit 6943989
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion src/gameobjects/bitmaptext/static/BitmapText.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var Render = require('./BitmapTextRender');
* @extends Phaser.GameObjects.Components.Alpha
* @extends Phaser.GameObjects.Components.BlendMode
* @extends Phaser.GameObjects.Components.Depth
* @extends Phaser.GameObjects.Components.GetBounds
* @extends Phaser.GameObjects.Components.Mask
* @extends Phaser.GameObjects.Components.Origin
* @extends Phaser.GameObjects.Components.Pipeline
Expand All @@ -71,6 +72,7 @@ var BitmapText = new Class({
Components.Alpha,
Components.BlendMode,
Components.Depth,
Components.GetBounds,
Components.Mask,
Components.Origin,
Components.Pipeline,
Expand Down Expand Up @@ -952,6 +954,8 @@ var BitmapText = new Class({
/**
* The width of this Bitmap Text.
*
* This property is read-only.
*
* @name Phaser.GameObjects.BitmapText#width
* @type {number}
* @readonly
Expand All @@ -969,7 +973,9 @@ var BitmapText = new Class({
},

/**
* The height of this bitmap text.
* The height of this Bitmap text.
*
* This property is read-only.
*
* @name Phaser.GameObjects.BitmapText#height
* @type {number}
Expand All @@ -987,6 +993,48 @@ var BitmapText = new Class({

},

/**
* The displayed width of this Bitmap Text.
*
* This value takes into account the scale factor.
*
* This property is read-only.
*
* @name Phaser.GameObjects.BitmapText#displayWidth
* @type {number}
* @readonly
* @since 3.60.0
*/
displayWidth: {

get: function ()
{
return this.width;
}

},

/**
* The displayed height of this Bitmap Text.
*
* This value takes into account the scale factor.
*
* This property is read-only.
*
* @name Phaser.GameObjects.BitmapText#displayHeight
* @type {number}
* @readonly
* @since 3.60.0
*/
displayHeight: {

get: function ()
{
return this.height;
}

},

/**
* Build a JSON representation of this Bitmap Text.
*
Expand Down

0 comments on commit 6943989

Please sign in to comment.