From 6fde862f610f2c04c2ccda9e77bf191ea4ef0613 Mon Sep 17 00:00:00 2001 From: Cameron Foale Date: Thu, 19 Sep 2013 16:57:19 +1000 Subject: [PATCH] Make Phaser.Text play nicely with scrolling, by using an explicit x, y --- src/gameobjects/Text.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/gameobjects/Text.js b/src/gameobjects/Text.js index b919dffa..8c195b2f 100644 --- a/src/gameobjects/Text.js +++ b/src/gameobjects/Text.js @@ -21,8 +21,8 @@ Phaser.Text = function (game, x, y, text, style) { this.type = Phaser.TEXT; - this.position.x = x; - this.position.y = y; + this.position.x = this.x = x; + this.position.y = this.y = y; // Replaces the PIXI.Point with a slightly more flexible one this.anchor = new Phaser.Point(); @@ -91,26 +91,3 @@ Object.defineProperty(Phaser.Text.prototype, 'angle', { }); -Object.defineProperty(Phaser.Text.prototype, 'x', { - - get: function() { - return this.position.x; - }, - - set: function(value) { - this.position.x = value; - } - -}); - -Object.defineProperty(Phaser.Text.prototype, 'y', { - - get: function() { - return this.position.y; - }, - - set: function(value) { - this.position.y = value; - } - -});