箭头bug修复

This commit is contained in:
艾竹
2023-02-04 12:17:03 +08:00
parent 8bec9b446f
commit bf5717cf25
3 changed files with 83 additions and 60 deletions

View File

@@ -10,7 +10,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
var angleInRadians = Math.Atan2(route[1].Y - route[0].Y, route[1].X - route[0].X) + Math.PI;
var xChange = markerWidth * Math.Cos(angleInRadians);
var yChange = markerWidth * Math.Sin(angleInRadians);
var yChange = markerHeight * Math.Sin(angleInRadians);
route[0] = new PointBase(route[0].X - xChange, route[0].Y - yChange);
return angleInRadians * 180 / Math.PI;
}
@@ -19,7 +19,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
var angleInRadians = Math.Atan2(route[route.Length - 1].Y - route[route.Length - 2].Y, route[route.Length - 1].X - route[route.Length - 2].X);
var xChange = markerWidth * Math.Cos(angleInRadians);
var yChange = markerWidth * Math.Sin(angleInRadians);
var yChange = markerHeight * Math.Sin(angleInRadians);
route[route.Length - 1] = new PointBase(route[route.Length - 1].X - xChange, route[route.Length - 1].Y - yChange);
return angleInRadians * 180 / Math.PI;
}