Commits

Alexandex Hohlov  committed a9b07de

flip-fix for js-target

  • Participants
  • Parent commits 807a07b

Comments (0)

Files changed (1)

File src/spinehx/platform/nme/renderers/SkeletonRenderer.hx

     public function draw () {
         graphics.clear();
 		var drawOrder:Array<Slot> = skeleton.drawOrder;
+		var flipX:Int = (skeleton.flipX) ? -1 : 1;
+		var flipY:Int = (skeleton.flipY) ? 1 : -1;
+		var flip:Int = flipX * flipY;
 		for (slot in drawOrder) {
 			var attachment:Attachment = slot.attachment;
 			if (Std.is(attachment, RegionAttachment)) {
                 var y:Float = regionAttachment.y - region.offsetY;
                 wrapper.x = bone.worldX + x * bone.m00 + y * bone.m01;
                 wrapper.y = bone.worldY + x * bone.m10 + y * bone.m11;
-                wrapper.rotation = -(bone.worldRotation + regionAttachment.rotation);
-                wrapper.scaleX = bone.worldScaleX + regionAttachment.scaleX - 1;
-                wrapper.scaleY = bone.worldScaleY + regionAttachment.scaleY - 1;
+                wrapper.rotation = -(bone.worldRotation + regionAttachment.rotation) * flip;
+                wrapper.scaleX = (bone.worldScaleX + regionAttachment.scaleX - 1) * flipX;
+                wrapper.scaleY = (bone.worldScaleY + regionAttachment.scaleY - 1) * flipY;
 
                 wrapper.visible = true;
             }