mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[ts][canvas] Cleanup
This commit is contained in:
parent
3bb27040c4
commit
f5b4310350
@ -242,17 +242,15 @@ var spine;
|
||||
var bone = slot.bone;
|
||||
var w = region.width;
|
||||
var h = region.height;
|
||||
var offsetX = attachment.offset[0];
|
||||
var offsetY = attachment.offset[1];
|
||||
ctx.save();
|
||||
ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
|
||||
ctx.translate(offsetX, offsetY);
|
||||
ctx.translate(attachment.offset[0], attachment.offset[1]);
|
||||
ctx.rotate(attachment.rotation * Math.PI / 180);
|
||||
ctx.scale(attachment.scaleX, attachment.scaleY);
|
||||
ctx.translate(region.width / 2, region.height / 2);
|
||||
ctx.translate(w / 2, h / 2);
|
||||
ctx.scale(1, -1);
|
||||
ctx.translate(-region.width / 2, -region.height / 2);
|
||||
ctx.drawImage(image, region.x, region.y, region.width, region.height, 0, 0, w, h);
|
||||
ctx.translate(-w / 2, -h / 2);
|
||||
ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h);
|
||||
if (this.debugRendering)
|
||||
ctx.strokeRect(0, 0, w, h);
|
||||
ctx.restore();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -67,17 +67,15 @@ module spine.canvas {
|
||||
let bone = slot.bone;
|
||||
let w = region.width;
|
||||
let h = region.height;
|
||||
let offsetX = attachment.offset[0];
|
||||
let offsetY = attachment.offset[1];
|
||||
ctx.save();
|
||||
ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
|
||||
ctx.translate(offsetX, offsetY);
|
||||
ctx.translate(attachment.offset[0], attachment.offset[1]);
|
||||
ctx.rotate(attachment.rotation * Math.PI / 180);
|
||||
ctx.scale(attachment.scaleX, attachment.scaleY);
|
||||
ctx.translate(region.width / 2, region.height / 2);
|
||||
ctx.translate(w / 2, h / 2);
|
||||
ctx.scale(1, -1);
|
||||
ctx.translate(-region.width / 2, -region.height / 2);
|
||||
ctx.drawImage(image, region.x, region.y, region.width, region.height, 0, 0, w, h);
|
||||
ctx.translate(-w / 2, -h / 2);
|
||||
ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h);
|
||||
if (this.debugRendering) ctx.strokeRect(0, 0, w, h);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user