mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
Text padding is passed to the Text.setPadding method to handle.
This commit is contained in:
parent
7bd8bf2075
commit
4d71806bea
1 changed files with 6 additions and 9 deletions
|
@ -39,19 +39,16 @@ GameObjectCreator.register('text', function (config)
|
|||
text.resolution = GetAdvancedValue(config, 'resolution', 1);
|
||||
|
||||
// Padding
|
||||
// Either: { padding: 2 } or { padding: { x: 2, y: 2 }}
|
||||
// { padding: 2 }
|
||||
// { padding: { x: , y: }}
|
||||
// { padding: { left: , top: }}
|
||||
// { padding: { left: , right: , top: , bottom: }}
|
||||
|
||||
var padding = GetAdvancedValue(config, 'padding', null);
|
||||
|
||||
if (typeof padding === 'number')
|
||||
if (padding !== null)
|
||||
{
|
||||
text.padding.x = padding;
|
||||
text.padding.y = padding;
|
||||
}
|
||||
else if (padding !== null)
|
||||
{
|
||||
text.padding.x = GetAdvancedValue(padding, 'x', 1);
|
||||
text.padding.y = GetAdvancedValue(padding, 'y', 1);
|
||||
text.setPadding(padding);
|
||||
}
|
||||
|
||||
text.updateText();
|
||||
|
|
Loading…
Reference in a new issue