Hello,
I am playing around with the goJs library, but stumbled upon a problem I can’t figure out by myself.
I want two nodes to be able to connect to eachother. These nodes have multiples spots on which they can connect. I want the bottom spots to only connect to eachtother.
The left spots can only connect to a right spot.
This is the code that defines this type of node
var template = $$(go.Node, "Auto",
new go.Binding("location", "loc", go.Point.parse).makeTwoWay(go.Point.stringify),
$$(go.Shape, "RoundedRectangle", { fill: FlowDiagram.Color.BlockColor, stroke: FlowDiagram.Color.BlockBorderColor, width: 120, height: 50 }),
$$(go.Panel, "Position", { width: 120, height: 50 },
$$(go.Panel, { position: new go.Point(2, 21) }, $$(go.Shape, "Ellipse", { width: 10, height: 10, portId: "In", toSpot: go.Spot.Left, toLinkable: true, fromSpot: go.Spot.Right, toMaxLinks: 1, fromLinkable: false, fill: FlowDiagram.Color.PortColor, strokeWidth: 0 })),
$$(go.Panel, { position: new go.Point(108, 21) }, $$(go.Shape, "Ellipse", { width: 10, height: 10, portId: "Out", fromSpot: go.Spot.Right, toSpot: go.Spot.Left, fromLinkable: true, fromMaxLinks: 1, toLinkable: false, fill: FlowDiagram.Color.PortColor, strokeWidth: 0 })),
$$(go.Panel, { position: new go.Point(55, 38) }, $$(go.Shape, "Ellipse", { width: 10, height: 10, portId: "OutBack", fromSpot: go.Spot.Bottom, toSpot: go.Spot.Bottom, fromLinkable: true, fromMaxLinks: 1, toLinkable: true, fill: FlowDiagram.Color.PortColor, strokeWidth: 0 }))
),
$$(go.Panel, "Spot", { width: 100, height: 50 },
$$(go.TextBlock, { alignment: go.Spot.Center, textAlign: "center", margin: new go.Margin(12, 0), font: "normal 9pt sans-serif", stroke: FlowDiagram.Color.TextColor }, new go.Binding("text", "name"))
),
{ maxLocation: FlowDiagram.Config.MaxLocation, minLocation: new go.Point(50, 50) }
);
In this print screen, the left hand nodes are connected as they should be able to. But the right hand side shows what is not allowed, but is still possible.
Any help or remarks would be much appreciated.