Padding now passed in the style object and avoids double call to updateText

This commit is contained in:
Richard Davey 2017-12-01 03:11:23 +00:00
parent ef942fb204
commit 025c9dc131

View file

@ -29,15 +29,6 @@ GameObjectCreator.register('text', function (config)
var content = GetAdvancedValue(config, 'text', '');
var style = GetAdvancedValue(config, 'style', null);
var text = new Text(this.scene, 0, 0, content, style);
BuildGameObject(this.scene, text, config);
// Text specific config options:
text.autoRound = GetAdvancedValue(config, 'autoRound', true);
text.resolution = GetAdvancedValue(config, 'resolution', 1);
// Padding
// { padding: 2 }
// { padding: { x: , y: }}
@ -48,10 +39,17 @@ GameObjectCreator.register('text', function (config)
if (padding !== null)
{
text.setPadding(padding);
style.padding = padding;
}
text.updateText();
var text = new Text(this.scene, 0, 0, content, style);
BuildGameObject(this.scene, text, config);
// Text specific config options:
text.autoRound = GetAdvancedValue(config, 'autoRound', true);
text.resolution = GetAdvancedValue(config, 'resolution', 1);
return text;
});