Automatically connecting links: dragdrop


I would like to add 3 sorts of additional links to my GoPalette in the left of the screen:

The purpose of those links is to be able to drag them to the actual view.

This way the user wouldn’t have to always choose the link type from a menu though he can drag the nodes to the view from the palette.

How could one do that?

The links will not be of different types. only the generated data will be slightly different and the data is also responsible for copying them to different link layers.

First Problem: Links will not be shown in the palette if they are not connected to something.

Maybe I should use a go stroke?

Second Problem: How could I connect the link to the nearest nodes while dropping it?

Question: May I somehow rotate it while dragging it to provide a better way for the internal routine to find the nearest ports? or should I just use something of the RelationShipTool class (i.e. subroutine like FindNearestPort) to achieve it?


You can do this much more easily in GoDiagram 2.2:
If you are a customer, you have had access to the beta for a while. We’ll probably start a public beta soon.


Ok, I’ve already downloaded the beta and viewed in MovableLinkApp, will try to re-use some of this code in my application.

I guess it should work.