Retaining link shape when moving node 2


I am trying to make the orthogonal line link shapes to scale whenever I move connected objects.
I took BasicApp sample and changed the following code:

public class BasicLink : GoLink
public BasicLink()
this.Style = GoStrokeStyle.Line;
this.Orthogonal = true;
this.HighlightPen = new Pen(Color.Magenta, 5);
this.Pen = new Pen(Color.White, 2);
this.Brush = Brushes.White;
this.ToArrow = true;
this.Editable = true;
this.Selectable = true;
this.Reshapable = true;
this.Resizable = true;
this.AdjustingStyle = GoLinkAdjustingStyle.Scale;


The orthogonal lines are recalculated whnever I move an object.

The question is how can I make the orthogonal lines to scale when I move connected objects?

Thanks for any advice

Liviu Grigorescu

Scaling doesn’t make sense if you want to try to retain orthogonality, since as the direction from one port to another changes angle, the segments would need to change angle too, and that would mean those segments wouldn’t be either horizontal or vertical any more.
However, you can set the AdjustingStyle to End, not Calculate (which you don’t want), nor Scale nor Stretch (which don’t make sense).

I have tested with GoLinkAdjustingStyle.End and it still isn’t what I really want.

GoLinkAdjustingStyle.End means the middle line stays locked. I want this line to move when the user moves GoNodes like when GoLinkAdjustingStyle.Calculate is selected.

What I don’t like at GoLinkAdjustingStyle.Calculate is the fact that when the user drags the middle line and then moves one GoNode, the middle line is instantly set to be at the half of the distance between the two linked GoNodes.

Is there any solution to this problem?

Liviu Grigorescu

Yes, you can override GoLink.AdjustPoints to do what you want.
There are so many possible policies for what to do, that we cannot provide all plausible behaviors.