I have nodes and groups with ports defined like this:
function addInternalLinkPorts(fromNotLinkable)
{
return [
$go(go.Shape, "Rectangle",
{
fromLinkable: !fromNotLinkable, toLinkable: true, cursor: "pointer",
fromLinkableDuplicates: true, toLinkableDuplicates: true,
portId: "topPort", fromSpot: go.Spot.TopSide, toSpot: go.Spot.TopSide,
alignment: go.Spot.TopCenter,
opacity: 0
},
new go.Binding("toLinkable", "category", function (c) { return c !== "start"; }),
new go.Binding("desiredSize", "", function(data) { return scope.myDiagram.edgeSpreadEnabled ? new go.Size(internalPortSpreadSize - 1, 1) : new go.Size(1, 1)}),
),
$go(go.Shape, "Rectangle",
{
fromLinkable: !fromNotLinkable, toLinkable: true, cursor: "pointer",
fromLinkableDuplicates: true, toLinkableDuplicates: true,
portId: "leftPort", fromSpot: go.Spot.LeftSide, toSpot: go.Spot.LeftSide,
alignment: go.Spot.LeftCenter,
opacity: 0
},
new go.Binding("toLinkable", "category", function (c) { return c !== "start"; }),
new go.Binding("desiredSize", "", function(data) { return scope.myDiagram.edgeSpreadEnabled ? new go.Size(1, internalPortSpreadSize - 1) : new go.Size(1, 1)}),
),
$go(go.Shape, "Rectangle",
{
fromLinkable: !fromNotLinkable, toLinkable: true, cursor: "pointer",
fromLinkableDuplicates: true, toLinkableDuplicates: true,
portId: "rightPort", fromSpot: go.Spot.RightSide, toSpot: go.Spot.RightSide,
alignment: go.Spot.RightCenter,
opacity: 0
},
new go.Binding("toLinkable", "category", function (c) { return c !== "start"; }),
new go.Binding("desiredSize", "", function(data) { return scope.myDiagram.edgeSpreadEnabled ? new go.Size(1, internalPortSpreadSize - 1) : new go.Size(1, 1);}),
),
$go(go.Shape, "Rectangle",
{
fromLinkable: !fromNotLinkable, toLinkable: true, cursor: "pointer",
fromLinkableDuplicates: true, toLinkableDuplicates: true,
portId: "bottomPort", fromSpot: go.Spot.BottomSide, toSpot: go.Spot.BottomSide,
alignment: go.Spot.BottomCenter,
opacity: 0
},
new go.Binding("toLinkable", "category", function (c) { return c !== "start"; }),
new go.Binding("desiredSize", "", function(data) { return scope.myDiagram.edgeSpreadEnabled ? new go.Size(internalPortSpreadSize - 1, 1) : new go.Size(1, 1);}),
)
]
}
The purpose is that the edges spread in and out of nodes by using go.Spot.LeftSide etc.
It works for all nodes, but for Groups, it causes kinks like so:
I tracked down the issue and it happens in this part of the minified source code:
Essentially, it looks like for groups it uses findExternalLinksConnected which returns links from all ports, whereas for nodes it uses s.findLinksConnected(this.al.portId) which uses the port. This means that for the spreading purposes, it thinks there are 2 links on each side rather than 1 link on each side.
For now, I am using a workaround by overwritting computeSpot in a custom Link class, but would appreciate some feedback if there is a better fix and/or workaround




