Skip to content

Commit 2446e2f

Browse files
committed
Setting padding in a Text style configuration object would cause an error about calling split on undefined. Padding can now be applied both in the config and via setPadding
1 parent 458c592 commit 2446e2f

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/gameobjects/text/static/Text.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ var Text = new Class({
276276

277277
this.initRTL();
278278

279+
this.setText(text);
280+
279281
if (style && style.padding)
280282
{
281283
this.setPadding(style.padding);
@@ -286,8 +288,6 @@ var Text = new Class({
286288
this.lineSpacing = style.lineSpacing;
287289
}
288290

289-
this.setText(text);
290-
291291
if (scene.sys.game.config.renderType === CONST.WEBGL)
292292
{
293293
scene.sys.game.renderer.onContextRestored(function ()
@@ -1015,7 +1015,7 @@ var Text = new Class({
10151015
* @method Phaser.GameObjects.Text#setPadding
10161016
* @since 3.0.0
10171017
*
1018-
* @param {(number|object)} left - The left padding value, or a padding config object.
1018+
* @param {(number|Phaser.Types.GameObjects.Text.TextPadding)} left - The left padding value, or a padding config object.
10191019
* @param {number} top - The top padding value.
10201020
* @param {number} right - The right padding value.
10211021
* @param {number} bottom - The bottom padding value.

0 commit comments

Comments
 (0)