Skip to content

Commit aac2276

Browse files
committed
BitmapText.preDestroy is a new method that will tidy-up all of the BitmapText data during object destruction.
1 parent 64214db commit aac2276

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

src/gameobjects/bitmaptext/static/BitmapText.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,14 @@ var BitmapText = new Class({
215215
*/
216216
this.wordWrapCharCode = 32;
217217

218+
/**
219+
* Internal array holding the character tint color data.
220+
*
221+
* @name Phaser.GameObjects.BitmapText#charColors
222+
* @type {array}
223+
* @private
224+
* @since 3.50.0
225+
*/
218226
this.charColors = [];
219227

220228
this.setTexture(entry.texture, entry.frame);
@@ -357,6 +365,8 @@ var BitmapText = new Class({
357365
return this;
358366
},
359367

368+
369+
360370
/**
361371
* Sets a tint on a range of characters in this Bitmap Text, starting from the `start` parameter index
362372
* and running for `length` quantity of characters.
@@ -844,6 +854,20 @@ var BitmapText = new Class({
844854
out.data = data;
845855

846856
return out;
857+
},
858+
859+
/**
860+
* Internal destroy handler, called as part of the destroy process.
861+
*
862+
* @method Phaser.GameObjects.BitmapText#preDestroy
863+
* @protected
864+
* @since 3.50.0
865+
*/
866+
preDestroy: function ()
867+
{
868+
this.charColors.length = 0;
869+
this._bounds = null;
870+
this.fontData = null;
847871
}
848872

849873
});

0 commit comments

Comments
 (0)