mirror of
https://github.com/photonstorm/phaser
synced 2024-11-30 00:21:04 +00:00
Text can now accept undefined
or null
as the text
argument in the constructor and will cast it as an empty string.
This commit is contained in:
parent
80540ea919
commit
9a0b6c24a4
2 changed files with 11 additions and 1 deletions
|
@ -262,6 +262,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
|
|||
* TypeScript definitions fixes and updates (thanks @clark-stevenson @vrecluse)
|
||||
* JSDoc typo fixes (thanks )
|
||||
* VideoStream.active = false is used if the browser supports it, otherwise it falls back to VideoStream.stop.
|
||||
* Text can now accept `undefined` or `null` as the `text` argument in the constructor and will cast it as an empty string.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -40,7 +40,16 @@ Phaser.Text = function (game, x, y, text, style) {
|
|||
|
||||
x = x || 0;
|
||||
y = y || 0;
|
||||
text = text.toString() || '';
|
||||
|
||||
if (text === undefined || text === null)
|
||||
{
|
||||
text = '';
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.toString();
|
||||
}
|
||||
|
||||
style = style || {};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue