mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Fix TileSprite rotation.
The order of operations now no longer produces skew. Asymmetric scaling now no longer leaves some area untextured.
This commit is contained in:
parent
8e8b15841a
commit
9c3a1bdebb
1 changed files with 4 additions and 4 deletions
|
@ -558,16 +558,16 @@ var TileSprite = new Class({
|
||||||
|
|
||||||
ctx.save();
|
ctx.save();
|
||||||
|
|
||||||
ctx.scale(scaleX, scaleY);
|
|
||||||
|
|
||||||
ctx.rotate(this._tileRotation);
|
ctx.rotate(this._tileRotation);
|
||||||
|
|
||||||
|
ctx.scale(scaleX, scaleY);
|
||||||
|
|
||||||
ctx.translate(-positionX, -positionY);
|
ctx.translate(-positionX, -positionY);
|
||||||
|
|
||||||
ctx.fillStyle = this.fillPattern;
|
ctx.fillStyle = this.fillPattern;
|
||||||
|
|
||||||
var scaledWidth = width / scaleX;
|
var scaledWidth = Math.max(width, Math.abs(width / scaleX));
|
||||||
var scaledHeight = height / scaleY;
|
var scaledHeight = Math.max(height, Math.abs(height / scaleY));
|
||||||
var hypotenuse = Math.sqrt(scaledWidth * scaledWidth + scaledHeight * scaledHeight);
|
var hypotenuse = Math.sqrt(scaledWidth * scaledWidth + scaledHeight * scaledHeight);
|
||||||
|
|
||||||
ctx.fillRect(
|
ctx.fillRect(
|
||||||
|
|
Loading…
Reference in a new issue