This commit is contained in:
kwai
2023-08-03 20:06:02 +08:00
parent 5559a18c8e
commit 5ee23157e4

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -77,16 +78,20 @@ namespace AIStudio.Wpf.DiagramDesigner
var radian = Math.Atan2(endPoint.Y - startPoint.Y, endPoint.X - startPoint.X);
var angle = radian * 180 / Math.PI;
if (angle >= -90 && angle < 90)
{
return 90 - angle;
}
else
{
return angle - 90;
}
return ConvertToPositive360(90 - angle);
}
static double ConvertToPositive360(double angle)
{
double positiveAngle = angle % 360;
if (positiveAngle < 0)
{
positiveAngle += 360;
}
return positiveAngle;
}
}
}