Auto alignment of links based on node center

As seen the example BPMN we have an option align nodes & all the nodes get aligned based on node axis . Is there a way where links also can automatically aligned to node center so that we get a straight line between nodes ?

When I open the BPMN sample, http://gojs.net/latest/extensions/BPMN.html, I find that the links do connect automatically toward the node center.

However, if there are more than one link at a side, the links are spread out along that side. This is because the GraphObject.fromSpot and GraphObject.toSpot are set to Spots that are “…Side” values. See GoJS Link Connection Points on Nodes -- Northwoods Software, for example.

But that spreading behavior is just the default routing behavior for “…Side” spot ports. You can change that behavior by setting Node | GoJS API. I’m guessing that you want to set it to go.Node.SpreadingNone.

how can i align links & nodes in straight line?

The user can position them the way that they like.

You could enable grid-snapping along with Node.locationSpot being go.Spot.Center. See GoJS Grid Patterns -- Northwoods Software.

You can provide guidelines, as demonstrated in http://gojs.net/latest/extensions/FloorPlanEditor.html, by using http://gojs.net/latest/extensions/GuidedDraggingTool.js.

You could align programmatically yourself or by implementing your own custom Layout or using an existing layout such as TreeLayout.