diff --git a/src/core/sprites/canvas/CanvasSpriteRenderer.js b/src/core/sprites/canvas/CanvasSpriteRenderer.js index 118ecdf..700ee9b 100644 --- a/src/core/sprites/canvas/CanvasSpriteRenderer.js +++ b/src/core/sprites/canvas/CanvasSpriteRenderer.js @@ -46,8 +46,8 @@ wt = sprite.transform.worldTransform, dx, dy, - width = texture.crop.width, - height = texture.crop.height; + width = texture._frame.width, + height = texture._frame.height; if (texture.crop.width <= 0 || texture.crop.height <= 0) { @@ -68,18 +68,12 @@ renderer.context[renderer.smoothProperty] = smoothingEnabled; } - - //inline GroupD8.isSwapWidthHeight - if ((texture.rotate & 3) === 2) { - width = texture.crop.height; - height = texture.crop.width; - } if (texture.trim) { - dx = texture.crop.width/2 + texture.trim.x - sprite.anchor.x * texture.trim.width; - dy = texture.crop.height/2 + texture.trim.y - sprite.anchor.y * texture.trim.height; + dx = texture.trim.width/2 + texture.trim.x - this.anchor.x * texture.crop.width; + dy = texture.trim.height/2 + texture.trim.y - this.anchor.y * texture.crop.height; } else { - dx = (0.5 - sprite.anchor.x) * texture._frame.width; - dy = (0.5 - sprite.anchor.y) * texture._frame.height; + dx = (0.5 - this.anchor.x) * texture.crop.width; + dy = (0.5 - this.anchor.y) * texture.crop.height; } if(texture.rotate) { wt.copy(canvasRenderWorldTransform); diff --git a/src/core/sprites/canvas/CanvasSpriteRenderer.js b/src/core/sprites/canvas/CanvasSpriteRenderer.js index 118ecdf..700ee9b 100644 --- a/src/core/sprites/canvas/CanvasSpriteRenderer.js +++ b/src/core/sprites/canvas/CanvasSpriteRenderer.js @@ -46,8 +46,8 @@ wt = sprite.transform.worldTransform, dx, dy, - width = texture.crop.width, - height = texture.crop.height; + width = texture._frame.width, + height = texture._frame.height; if (texture.crop.width <= 0 || texture.crop.height <= 0) { @@ -68,18 +68,12 @@ renderer.context[renderer.smoothProperty] = smoothingEnabled; } - - //inline GroupD8.isSwapWidthHeight - if ((texture.rotate & 3) === 2) { - width = texture.crop.height; - height = texture.crop.width; - } if (texture.trim) { - dx = texture.crop.width/2 + texture.trim.x - sprite.anchor.x * texture.trim.width; - dy = texture.crop.height/2 + texture.trim.y - sprite.anchor.y * texture.trim.height; + dx = texture.trim.width/2 + texture.trim.x - this.anchor.x * texture.crop.width; + dy = texture.trim.height/2 + texture.trim.y - this.anchor.y * texture.crop.height; } else { - dx = (0.5 - sprite.anchor.x) * texture._frame.width; - dy = (0.5 - sprite.anchor.y) * texture._frame.height; + dx = (0.5 - this.anchor.x) * texture.crop.width; + dy = (0.5 - this.anchor.y) * texture.crop.height; } if(texture.rotate) { wt.copy(canvasRenderWorldTransform); diff --git a/src/core/textures/TextureUvs.js b/src/core/textures/TextureUvs.js index ed43b59..f74ea7d 100644 --- a/src/core/textures/TextureUvs.js +++ b/src/core/textures/TextureUvs.js @@ -47,11 +47,8 @@ if(rotate) { //width and height div 2 div baseFrame size - - var swapWidthHeight = GroupD8.isSwapWidthHeight(rotate); - var w2 = (swapWidthHeight ? frame.height : frame.width) / 2 / tw; - var h2 = (swapWidthHeight ? frame.width : frame.height) / 2 / th; - + var w2 = frame.width / 2 / tw; + var h2 = frame.height / 2 / th; //coordinates of center var cX = frame.x / tw + w2; var cY = frame.y / th + h2;