CalculateStroke method in GoLink


#1

I’ve overriden the CalculateStroke method in GoLink to plot a GoNode half way along the segment and a bit offset when the segment is drawn. For the most part it works well, the GoNode is moved automatically as I move the endpoints and intermediate points. The problem I am experiencing is when this segment is part of a SubGraph that is collapsed. When the View is being generated, the nodes seem to have a collapsed value, but when I open the SubConfig in a new view, the CalculateStroke method isn’t being called. This results in the GoNodes being plotted where the parent node was located instead of next to the GoLink as desired. Is there an event that is in GoLink that can be turned on to force a CalculateStroke?


#2

I suspect you are overriding GoLink.CalculateStroke for the wrong purpose. That method is responsible for setting the points in the stroke, not for positioning any other objects.
Is the GoNode you are trying to position an independent object from the link? Or could it be a child of (i.e. owned by) the link? If the latter case, you could just make the GoNode be the GoLabeledLink.MidLabel, and then override LayoutMidLabel to position the GoNode/MidLabel as you please.
Actually, many kinds of changes to either port of a link will cause GoLink.OnPortChanged to call CalculateStroke.