TextBlock alignment of Link changes after connecting it to port


Code for Port:
$(go.Shape, “Circle”,

		fill: "gray",
		name: "OUT",
		fromSpot: go.Spot.Right,
		toSpot: go.Spot.Right,
		alignment: go.Spot.Right,
		alignmentFocus: go.Spot.Right,
		desiredSize: new go.Size(8, 8),
		portId: "OUT",
		toMaxLinks: 1,
		cursor: "pointer"

Code for TextBlock:
$(go.TextBlock, “Line”,

	segmentIndex: 0,
	segmentFraction: 0.5,
	segmentOffset: new go.Point(0, -8),
	alignment: go.Spot.Center,
	textAlign: "center",
	editable: true,
	name: "TB"


Because the port(s) have “spots”, the route for the links will have 3 segments, not just one. There is an end segment at the fromPort, then the main segment running from near the fromPort to the toPort, and then an end segment at the toPort.

So when connected the middle of the link is on segment #1.

I suggest that you remove the segmentIndex and segmentFraction properties, and allow the default positioning of the label to put it at the middle of the link.

Could you give us some information about how it didn’t do what you wanted? What did it do?