From e4595d2a41b56fcb05932e917211a8553cdbb0aa Mon Sep 17 00:00:00 2001 From: TheJare Date: Sat, 21 Sep 2013 01:03:19 +0100 Subject: [PATCH] Fix box dimensions in PIXI.BitmapText. Support anchor in Phaser.BitmapText --- src/gameobjects/BitmapText.js | 3 +++ src/pixi/text/BitmapText.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gameobjects/BitmapText.js b/src/gameobjects/BitmapText.js index ea73b007..42dfaf11 100644 --- a/src/gameobjects/BitmapText.js +++ b/src/gameobjects/BitmapText.js @@ -80,6 +80,9 @@ Phaser.BitmapText.prototype.update = function() { this._cache.dirty = true; } + this.pivot.x = this.anchor.x*this.width; + this.pivot.y = this.anchor.y*this.height; + } Object.defineProperty(Phaser.BitmapText.prototype, 'angle', { diff --git a/src/pixi/text/BitmapText.js b/src/pixi/text/BitmapText.js index b667172f..d2890c78 100644 --- a/src/pixi/text/BitmapText.js +++ b/src/pixi/text/BitmapText.js @@ -135,7 +135,7 @@ PIXI.BitmapText.prototype.updateText = function() this.addChild(c); } - this.width = pos.x * scale; + this.width = maxLineWidth * scale; this.height = (pos.y + data.lineHeight) * scale; };