diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 6be6ab2..9a74c38 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -140,9 +140,9 @@ { this.updateText(true); - var sign = utils.sign(this.scale.x) || 1; - this.scale.x = sign * value / this.texture.orig.width; - this._width = value; + var sign = utils.sign(this.scale.y) || 1; + this.scale.y = sign * value / this.texture.orig.height; + this._height = value; } }, diff --git a/src/core/text/Text.js b/src/core/text/Text.js index 6be6ab2..9a74c38 100644 --- a/src/core/text/Text.js +++ b/src/core/text/Text.js @@ -140,9 +140,9 @@ { this.updateText(true); - var sign = utils.sign(this.scale.x) || 1; - this.scale.x = sign * value / this.texture.orig.width; - this._width = value; + var sign = utils.sign(this.scale.y) || 1; + this.scale.y = sign * value / this.texture.orig.height; + this._height = value; } }, diff --git a/test/core/Text.js b/test/core/Text.js index a2c510c..61cfac7 100644 --- a/test/core/Text.js +++ b/test/core/Text.js @@ -49,5 +49,23 @@ text.destroy({children: true, texture: true}); expect(childDestroyOpts).to.deep.equal({children: true, texture: true, baseTexture:true}); }); + + it('should modify the height of the object when setting height', function () { + + var text = new PIXI.Text("foo"); + text.height = 300; + + expect(text.height).to.equal(300); + + }); + + it('should modify the width of the object when setting width', function () { + + var text = new PIXI.Text("foo"); + text.width = 300; + + expect(text.width).to.equal(300); + + }); }); });