Skip to content

Commit 025c9dc

Browse files
committed
Padding now passed in the style object and avoids double call to updateText
1 parent ef942fb commit 025c9dc

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

v3/src/gameobjects/text/static/TextCreator.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,6 @@ GameObjectCreator.register('text', function (config)
2929
var content = GetAdvancedValue(config, 'text', '');
3030
var style = GetAdvancedValue(config, 'style', null);
3131

32-
var text = new Text(this.scene, 0, 0, content, style);
33-
34-
BuildGameObject(this.scene, text, config);
35-
36-
// Text specific config options:
37-
38-
text.autoRound = GetAdvancedValue(config, 'autoRound', true);
39-
text.resolution = GetAdvancedValue(config, 'resolution', 1);
40-
4132
// Padding
4233
// { padding: 2 }
4334
// { padding: { x: , y: }}
@@ -48,10 +39,17 @@ GameObjectCreator.register('text', function (config)
4839

4940
if (padding !== null)
5041
{
51-
text.setPadding(padding);
42+
style.padding = padding;
5243
}
5344

54-
text.updateText();
45+
var text = new Text(this.scene, 0, 0, content, style);
46+
47+
BuildGameObject(this.scene, text, config);
48+
49+
// Text specific config options:
50+
51+
text.autoRound = GetAdvancedValue(config, 'autoRound', true);
52+
text.resolution = GetAdvancedValue(config, 'resolution', 1);
5553

5654
return text;
5755
});

0 commit comments

Comments
 (0)