mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 23:20:59 +00:00
Padding now passed in the style object and avoids double call to updateText
This commit is contained in:
parent
ef942fb204
commit
025c9dc131
1 changed files with 9 additions and 11 deletions
|
@ -29,15 +29,6 @@ GameObjectCreator.register('text', function (config)
|
||||||
var content = GetAdvancedValue(config, 'text', '');
|
var content = GetAdvancedValue(config, 'text', '');
|
||||||
var style = GetAdvancedValue(config, 'style', null);
|
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
|
||||||
// { padding: 2 }
|
// { padding: 2 }
|
||||||
// { padding: { x: , y: }}
|
// { padding: { x: , y: }}
|
||||||
|
@ -48,10 +39,17 @@ GameObjectCreator.register('text', function (config)
|
||||||
|
|
||||||
if (padding !== null)
|
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;
|
return text;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue