diff --git a/src/extras/TilingSprite.js b/src/extras/TilingSprite.js index a8bb4f5..4efc453 100644 --- a/src/extras/TilingSprite.js +++ b/src/extras/TilingSprite.js @@ -161,14 +161,14 @@ var uvs = this._uvs; - this.tilePosition.x %= texture.baseTexture.width * this._tileScaleOffset.x; - this.tilePosition.y %= texture.baseTexture.height * this._tileScaleOffset.y; + this.tilePosition.x %= texture.baseTexture.width / this._tileScaleOffset.x; + this.tilePosition.y %= texture.baseTexture.height / this._tileScaleOffset.y; - var offsetX = this.tilePosition.x/(texture.baseTexture.width*this._tileScaleOffset.x); - var offsetY = this.tilePosition.y/(texture.baseTexture.height*this._tileScaleOffset.y); + var offsetX = this.tilePosition.x/(texture.baseTexture.width / this._tileScaleOffset.x); + var offsetY = this.tilePosition.y/(texture.baseTexture.height / this._tileScaleOffset.y); - var scaleX = (this._width / texture.baseTexture.width); - var scaleY = (this._height / texture.baseTexture.height); + var scaleX = (this._width / texture.baseTexture.width) * this._tileScaleOffset.x; + var scaleY = (this._height / texture.baseTexture.height) * this._tileScaleOffset.y; scaleX /= this.tileScale.x; scaleY /= this.tileScale.y; @@ -416,6 +416,10 @@ renderer.setRenderTarget(cachedRenderTarget); + + this._tileScaleOffset.x = tempSprite.worldTransform.a; + this._tileScaleOffset.y = tempSprite.worldTransform.d; + this._tilingTexture = renderTexture; } else