Hi again,
This was working just fine, but since upgrading to 5.0.3 the self-loopback connector is broken. See the attached screenshot.
I've included my latest code (that worked in 4.2) below. I'm taking the Else path which should cause the link to come out of the top and back into the top.
Any suggestions?
Thanks
Jim
The Code:
protected void createSelfLoopback(ShapeNode node, DiagramLink link)
{
RectangleF r = node.Bounds;
float dist = 6;
if (node.Shape != Shapes.RoundRect)
{
float centerx = (float)(r.Left + r.Width / 2);
float centerY = (float)(r.Top + r.Height / 2);
SetLinkPoints(link,
new PointF(r.Right, centerY),
new PointF(r.Right + dist, centerY),
new PointF(r.Right + dist, r.Top - dist),
new PointF(r.Left - dist, r.Top - dist),
new PointF(r.Left - dist, centerY),
new PointF(r.Left, centerY));
}
else
{
SetLinkPoints(link,
new PointF(r.Right - 2, r.Top),
new PointF(r.Right - 2, r.Top - 6),
new PointF(r.Left + 2, r.Top - 6),
new PointF(r.Left + 2, r.Top));
}
}
protected void SetLinkPoints(DiagramLink link, params PointF[] points)
{
link.AutoRoute = false;
link.Shape = LinkShape.Cascading;
link.ControlPoints.Clear();
link.ControlPoints.AddRange(points);
link.UpdateFromPoints(false, true);
}