Kenric Nugteren 2 meses atrás
pai
commit
7cb3183101
2 arquivos alterados com 6 adições e 6 exclusões
  1. 5 5
      inabox.dxf/DrawData.cs
  2. 1 1
      inabox.dxf/Utils.cs

+ 5 - 5
inabox.dxf/DrawData.cs

@@ -529,11 +529,11 @@ public class PdfGraphics : IGraphics
 
         var point = _transform.Transform(position);
         Graphics.TranslateTransform(point.X, point.Y);
-        Graphics.RotateTransform(-(_transform.GetRotation() + rotation));
+        Graphics.RotateTransform(_transform.GetRotation() - rotation);
 
-        var scaled = _transform.TransformVector(new(1, -1));
+        var scaled = _transform.GetScale();
 
-        Graphics.ScaleTransform(scaled.X / _ascentRatio, scaled.Y / _ascentRatio);
+        Graphics.ScaleTransform(scaled / _ascentRatio, scaled / _ascentRatio);
         Graphics.DrawString(text, _font, new PdfSolidBrush(color), new PointF(), fmt);
 
         Graphics.Restore();
@@ -544,7 +544,7 @@ public class PdfGraphics : IGraphics
 
         var point = _transform.Transform(position);
         Graphics.TranslateTransform(point.X, point.Y);
-        Graphics.RotateTransform(-(_transform.GetRotation()) + rotation);
+        Graphics.RotateTransform(_transform.GetRotation() - rotation);
         var scaleFactor = (_font.Height / _font.Size) * _transform.GetScale();
         Graphics.ScaleTransform(scaleFactor, scaleFactor * scale.Y);
         if(scale.X != 1)
@@ -569,7 +569,7 @@ public class PdfGraphics : IGraphics
 
         var point = _transform.Transform(position);
         Graphics.TranslateTransform(point.X, point.Y);
-        Graphics.RotateTransform(-(_transform.GetRotation()) + rotation);
+        Graphics.RotateTransform(_transform.GetRotation() - rotation);
         var scaleFactor = (_font.Height / _font.Size) * _transform.GetScale();
         Graphics.ScaleTransform(scaleFactor, scaleFactor * scale.Y);
         if(scale.X != 1 || scale.Y != 1)

+ 1 - 1
inabox.dxf/Utils.cs

@@ -30,7 +30,7 @@ internal static class Utils
     public static float GetRotation(this Matrix matrix)
     {
         var vec = matrix.TransformVector(new PointF(1, 0));
-        return (float)Math.Atan2(vec.Y, vec.X);
+        return (float)(Math.Atan2(vec.Y, vec.X) * 180 / Math.PI);
     }
 
     public static float GetScale(this Matrix matrix)