mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[ts][canvas] Fixed rendering of rotated atlas regions
This commit is contained in:
parent
ff98e136a1
commit
d520830c5c
@ -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
@ -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) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user