Sfoglia il codice sorgente

[ts][canvas] Cleanup

badlogic 8 anni fa
parent
commit
f5b4310350

+ 4 - 6
spine-ts/build/spine-canvas.js

@@ -242,17 +242,15 @@ var spine;
                     var bone = slot.bone;
                     var bone = slot.bone;
                     var w = region.width;
                     var w = region.width;
                     var h = region.height;
                     var h = region.height;
-                    var offsetX = attachment.offset[0];
-                    var offsetY = attachment.offset[1];
                     ctx.save();
                     ctx.save();
                     ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
                     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.rotate(attachment.rotation * Math.PI / 180);
                     ctx.scale(attachment.scaleX, attachment.scaleY);
                     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.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)
                     if (this.debugRendering)
                         ctx.strokeRect(0, 0, w, h);
                         ctx.strokeRect(0, 0, w, h);
                     ctx.restore();
                     ctx.restore();

File diff suppressed because it is too large
+ 0 - 0
spine-ts/build/spine-canvas.js.map


+ 4 - 6
spine-ts/canvas/src/SkeletonRenderer.ts

@@ -67,17 +67,15 @@ module spine.canvas {
 				let bone = slot.bone;
 				let bone = slot.bone;
 				let w = region.width;
 				let w = region.width;
 				let h = region.height;
 				let h = region.height;
-				let offsetX = attachment.offset[0];
-				let offsetY = attachment.offset[1];
 				ctx.save();
 				ctx.save();
 				ctx.transform(bone.a, bone.c, bone.b, bone.d, bone.worldX, bone.worldY);
 				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.rotate(attachment.rotation * Math.PI / 180);
 				ctx.scale(attachment.scaleX, attachment.scaleY);
 				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.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);
 				if (this.debugRendering) ctx.strokeRect(0, 0, w, h);
 				ctx.restore();
 				ctx.restore();
 			}
 			}

Some files were not shown because too many files changed in this diff