Skip to content

Commit b8b7369

Browse files
committed
Text cast to a string, avoids errors with creating Text using numbers.
1 parent 234ded0 commit b8b7369

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • v3/src/gameobjects/text/static

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ var Text = new Class({
3232
{
3333
if (x === undefined) { x = 0; }
3434
if (y === undefined) { y = 0; }
35-
if (text === undefined) { text = ' '; }
35+
if (text === undefined) { text = ''; }
36+
37+
// Cast to string whatever our value may be (numeric, etc)
38+
text = text.toString();
3639

3740
GameObject.call(this, scene, 'Text');
3841

@@ -84,7 +87,9 @@ var Text = new Class({
8487
}
8588

8689
var _this = this;
87-
scene.sys.game.renderer.addContextRestoredCallback(function (renderer) {
90+
91+
scene.sys.game.renderer.addContextRestoredCallback(function ()
92+
{
8893
_this.canvasTexture = null;
8994
_this.dirty = true;
9095
});

0 commit comments

Comments
 (0)