Link rendering time


#1

We construct a new node type inheriting from GoNode, consisting of two GoIconicNodes linked by a GoLabeledLink, with some properties and event handling set to ensure each node conforms to some arbitrary group rules. We first set properties of the link, and add the link to the group node, then add the two iconic nodes to the group node.
When we drop the group node onto a canvas, the link is at that time either incomplete or partially hidden (the arrow is not visible), until such time as we invoke CalculateStroke on the real link after the fact.
How should we have handled this situation in order for the link to appear completely rendered at the time it was dropped on the canvas? Advice is greatly appreciated.


#2

The implementation of GoPort.GetNearestIntersectionPoint should depend on the bounds and shape of the PortObject, which in the case of a GoIconicNode is the whole node itself.
However, it cannot do so until the PortObject belongs to a GoLayer. Until your GoNode and its two GoIconicNode children have been added to a GoLayer, GoPort.GetNearestIntersectionPoint just returns the nearest intersection point for the bounds of the GoPort.
I’ll investigate to see if there’s a general way to avoid the extra CalculateStroke call that you are doing. In the meantime, I assume you can get by with calling CalculateStroke explicitly in your GoView.ClipboardPasted and GoView.ExternalObjectsDropped event handlers.