File tree Expand file tree Collapse file tree
src/gameobjects/bitmaptext/static Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,6 +159,21 @@ var BitmapText = new Class({
159159 */
160160 this . letterSpacing = 0 ;
161161
162+ /**
163+ * Aligns the BitmapText when using multiple lines of text (has no effect on single-lines of text)
164+ *
165+ * 0 = Left aligned (default)
166+ * 1 = Right aligned
167+ * 2 = Middle aligned
168+ *
169+ * The alignment position is based on the longest line of text.
170+ *
171+ * @name Phaser.GameObjects.BitmapText#align
172+ * @type {integer }
173+ * @since 3.11.0
174+ */
175+ this . align = 0 ;
176+
162177 this . setText ( text ) ;
163178
164179 this . setTexture ( entry . texture , entry . frame ) ;
@@ -244,6 +259,8 @@ var BitmapText = new Class({
244259 this . text = value . toString ( ) ;
245260
246261 this . updateDisplayOrigin ( ) ;
262+
263+ GetBitmapTextSize ( this , false , this . _bounds ) ;
247264 }
248265
249266 return this ;
@@ -268,10 +285,11 @@ var BitmapText = new Class({
268285 */
269286 getTextBounds : function ( round )
270287 {
271- // local = the BitmapText based on fontSize and 0x0 coords
272- // global = the BitmapText, taking into account scale and world position
288+ // local = The BitmapText based on fontSize and 0x0 coords
289+ // global = The BitmapText, taking into account scale and world position
290+ // lines = The BitmapText line data
273291
274- this . _bounds = GetBitmapTextSize ( this , round ) ;
292+ GetBitmapTextSize ( this , round , this . _bounds ) ;
275293
276294 return this . _bounds ;
277295 } ,
You can’t perform that action at this time.
0 commit comments