[ts][canvas] Fixed rendering of rotated atlas regions

This commit is contained in:
badlogic 2017-04-07 14:54:08 +02:00
parent ff98e136a1
commit d520830c5c
6 changed files with 16049 additions and 16037 deletions

View File

@ -259,6 +259,12 @@ var spine;
ctx.rotate(attachment.rotation * Math.PI / 180); ctx.rotate(attachment.rotation * Math.PI / 180);
ctx.scale(attachment.scaleX, attachment.scaleY); ctx.scale(attachment.scaleX, attachment.scaleY);
ctx.translate(w / 2, h / 2); ctx.translate(w / 2, h / 2);
if (attachment.region.rotate) {
var t = w;
w = h;
h = t;
ctx.rotate(-Math.PI / 2);
}
ctx.scale(1, -1); ctx.scale(1, -1);
ctx.translate(-w / 2, -h / 2); ctx.translate(-w / 2, -h / 2);
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {

File diff suppressed because one or more lines are too long

View File

@ -90,6 +90,12 @@ module spine.canvas {
ctx.rotate(attachment.rotation * Math.PI / 180); ctx.rotate(attachment.rotation * Math.PI / 180);
ctx.scale(attachment.scaleX, attachment.scaleY); ctx.scale(attachment.scaleX, attachment.scaleY);
ctx.translate(w / 2, h / 2); ctx.translate(w / 2, h / 2);
if (attachment.region.rotate) {
let t = w;
w = h;
h = t;
ctx.rotate(-Math.PI / 2);
}
ctx.scale(1, -1); ctx.scale(1, -1);
ctx.translate(-w / 2, -h / 2); ctx.translate(-w / 2, -h / 2);
if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) {