From 6ed34bd94bd51e3d1bc173ba3693be2eb6f2699f Mon Sep 17 00:00:00 2001 From: elmon-tan Date: Tue, 29 Nov 2016 16:13:40 +0100 Subject: [PATCH] Fix for BitmapText when sprites has regX different from 0 Sprite.regX is considered when character is drawed but not in the x shift for the next letter. The solution is to draw the letter without the regX shift (without the transparent space left) --- src/easeljs/display/BitmapText.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/easeljs/display/BitmapText.js b/src/easeljs/display/BitmapText.js index 7856c0f0f..7b80f6afc 100644 --- a/src/easeljs/display/BitmapText.js +++ b/src/easeljs/display/BitmapText.js @@ -323,11 +323,12 @@ this.createjs = this.createjs || {}; } sprite.spriteSheet = ss; sprite.gotoAndStop(index); - sprite.x = x; + var spriteBounds = sprite.getBounds(); + sprite.x = x - spriteBounds.x; sprite.y = y; childIndex++; - x += sprite.getBounds().width + this.letterSpacing; + x += spriteBounds.width + this.letterSpacing; } while (numKids > childIndex) { // faster than removeChild. @@ -340,4 +341,4 @@ this.createjs = this.createjs || {}; createjs.BitmapText = createjs.promote(BitmapText, "Container"); -}()); \ No newline at end of file +}());