Hi,
another question (sorry...
)
I tried to make a bezier-shape using an unconnected link, like this:
var pos = // ...some diagram position
var link = this.Diagram.Factory.CreateDiagramLink(new PointF(), new PointF(1, 0));
link.IgnoreLayout = true;
link.AutoRoute = false;
link.Shape = LinkShape.Bezier;
link.ControlPoints.Clear();
link.ControlPoints.AddRange(new[]
{
new PointF(pos.X - 20, pos.Y), // P1
new PointF(pos.X - 20, pos.Y + 10),
new PointF(pos.X - 10, pos.Y + 20),
new PointF(pos.X, pos.Y + 20), // P2
new PointF(pos.X + 10, pos.Y + 20),
new PointF(pos.X + 20, pos.Y + 10),
new PointF(pos.X + 20, pos.Y), // P3
new PointF(pos.X + 20, pos.Y - 10),
new PointF(pos.X + 10, pos.Y - 20),
new PointF(pos.X, pos.Y - 20), // P4
new PointF(pos.X - 10, pos.Y - 20),
new PointF(pos.X - 20, pos.Y - 10),
new PointF(pos.X - 20, pos.Y) // P1 again
});
link.UpdateFromPoints(false, true);
This works and produces a closed bezier region like this:
I can drag control points to deform the region just fine:
Of course, if I happen to drag the 1st or last control point, this breaks, because one would suspect the last and first point should move together:
(in this case it isn't even possible to move the point, because in my diagram, unconnected links usually are not allowed.) And it would be cool to be able to move the whole bezier line by dragging the line (not one of its control points).
So: How would you implement a closed bezier line, that can be selected and moved around like a DiagramShape, and whose control points can be moved around like those of a DiagramLink with bezier LinkShape? Is this even possible? Will a custom Node-Type / a Composite-Node / a Custom Drawn Node do? Or should I try to handle events on the DiagramLink to allow dragging it to move it, and to move the last control point together with the 1st? (and the next-to-last control point together with the 2nd, to avoid a sharp corner of the bezier line at its start/end)?
Cheers,
Tim