Fixed an issue with SimpleEdgeRouting start and end points. It was using the upper left of the controls instead of the center, which resulted in an increase in undesirable routing outcomes. (#65)

This commit is contained in:
Jon 2016-09-01 00:05:52 -07:00 коммит произвёл Alexander Smirnov
Родитель f10c7c9708
Коммит 5d80aee72d
1 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -62,10 +62,12 @@ namespace GraphX.PCL.Logic.Algorithms.EdgeRouting
//bad edge data check
if (ctrl.Source.ID == -1 || ctrl.Target.ID == -1)
throw new GX_InvalidDataException("SimpleEdgeRouting() -> You must assign unique ID for each vertex to use SimpleER algo!");
if (ctrl.Source.ID == ctrl.Target.ID || !VertexPositions.ContainsKey(ctrl.Target)) return;
if (ctrl.Source.ID == ctrl.Target.ID || !VertexSizes.ContainsKey(ctrl.Source) || !VertexSizes.ContainsKey(ctrl.Target)) return;
var startPoint = VertexPositions[ctrl.Source];// new Point(GraphAreaBase.GetX(ctrl.Source), GraphAreaBase.GetY(ctrl.Source));
var endPoint = VertexPositions[ctrl.Target];// new Point(GraphAreaBase.GetX(ctrl.Target), GraphAreaBase.GetY(ctrl.Target));
var ss = VertexSizes[ctrl.Source];
var es = VertexSizes[ctrl.Target];
var startPoint = new Point(ss.X + ss.Width * 0.5, ss.Y + ss.Height * 0.5);
var endPoint = new Point(es.X + es.Width * 0.5, es.Y + es.Height * 0.5);
if (startPoint == endPoint) return;