How to make a bidirectional link snap to the same path?

Hi,

I am new to GoJS and I am creating an interactive diagram where user can drag and drop nodes and link them to each other and create diagrams of his choice. One of my requirement is that if the user creates a link between two nodes, which already has a link but in opposite direction, then the newly created link must snap to the existing link’s path with the arrow in the new(opposite) direction of the existing link. That means there should be only one link seen with arrows in opposite ends. Please help me how I can achieve this. Thanks for your support in advance!

Implement a “LinkDrawn” DiagramEvent listener that looks to see if there is already a link in the opposite direction. GoJS Events -- Northwoods Software and Node | GoJS API.

If there is, modify it to indicate that it is bidirectional. That means setting some data property that is used by a Binding to control the appearance of the “from” arrowhead. And delete the newly created Link.