diff --git a/src/core/display/Sprite.js b/src/core/display/Sprite.js index e4e9d01..d58e26f 100644 --- a/src/core/display/Sprite.js +++ b/src/core/display/Sprite.js @@ -346,8 +346,9 @@ } // If the texture is trimmed we offset by the trim x/y, otherwise we use the frame dimensions - var dx = (this.texture.trim ? this.texture.trim.x : 0) - (this.anchor.x * this.texture.trim.width); - var dy = (this.texture.trim ? this.texture.trim.y : 0) - (this.anchor.y * this.texture.trim.height); + var dx = (this.texture.trim) ? this.texture.trim.x - this.anchor.x * this.texture.trim.width : this.anchor.x * -this.texture._frame.width; + var dy = (this.texture.trim) ? this.texture.trim.y - this.anchor.y * this.texture.trim.height : this.anchor.y * -this.texture._frame.height; + // Allow for pixel rounding if (renderer.roundPixels) @@ -400,6 +401,7 @@ } else { +// console.log(resolution + " " + this.texture.crop) renderer.context.drawImage( this.texture.baseTexture.source, this.texture.crop.x, diff --git a/src/core/display/Sprite.js b/src/core/display/Sprite.js index e4e9d01..d58e26f 100644 --- a/src/core/display/Sprite.js +++ b/src/core/display/Sprite.js @@ -346,8 +346,9 @@ } // If the texture is trimmed we offset by the trim x/y, otherwise we use the frame dimensions - var dx = (this.texture.trim ? this.texture.trim.x : 0) - (this.anchor.x * this.texture.trim.width); - var dy = (this.texture.trim ? this.texture.trim.y : 0) - (this.anchor.y * this.texture.trim.height); + var dx = (this.texture.trim) ? this.texture.trim.x - this.anchor.x * this.texture.trim.width : this.anchor.x * -this.texture._frame.width; + var dy = (this.texture.trim) ? this.texture.trim.y - this.anchor.y * this.texture.trim.height : this.anchor.y * -this.texture._frame.height; + // Allow for pixel rounding if (renderer.roundPixels) @@ -400,6 +401,7 @@ } else { +// console.log(resolution + " " + this.texture.crop) renderer.context.drawImage( this.texture.baseTexture.source, this.texture.crop.x, diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index 3410199..f816da0 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -174,10 +174,18 @@ uvs.y3 = (1 * scaleY) - offsetY; var tempUvs = texture._uvs; - texture._uvs = uvs; - renderer.spriteRenderer.renderTilingSprite(this); - texture._uvs = tempUvs; + var tempWidth = texture._frame.width; + var tempHeight = texture._frame.height; + texture._uvs = uvs; + texture._frame.width = this.width; + texture._frame.height = this.height; + + renderer.spriteRenderer.render(this); + + texture._uvs = tempUvs; + texture._frame.width = tempWidth; + texture._frame.height = tempHeight; } };