Humm I dont understand.
By default I set the template with a spot for the From et the To
relinkingTool.fromHandleArchetype = this.getRelinkPortTemplate(0, go.Spot.Right);
relinkingTool.toHandleArchetype = this.getRelinkPortTemplate(-1, go.Spot.Left);
getRelinkPortTemplate(segmentIndex, spot) {
return this.go(go.Shape, 'Circle', {
alignmentFocus: spot,
fill: 'lightblue',
stroke: '#FF0000',
desiredSize: new go.Size(8, 8),
cursor: 'pointer',
segmentIndex,
});
}
This is this spot you want I change the position ? How to change this position only for the selected node, I dont see any method for this on the API ?
Another thing, I have changed my previous code for temporaryFromPort and temporaryFromNode like this :
const fromPortTemplate = this.getTemporaryPortTemplate();
const toPortTemplate = this.getTemporaryPortTemplate();
linkingTool.temporaryFromPort = fromPortTemplate;
linkingTool.temporaryFromNode = this.getTemporaryNodePortTemplate(fromPortTemplate);
linkingTool.temporaryToPort = toPortTemplate;
linkingTool.temporaryToNode = this.getTemporaryNodePortTemplate(toPortTemplate);
getTemporaryPortTemplate() {
return this.go(go.Shape, 'Circle', {
portId: '',
fill: null,
stroke: '#00FF00',
strokeWidth: 2,
desiredSize: new go.Size(1, 1),
});
}
getTemporaryNodePortTemplate(portTemplate) {
const node = this.go(go.Node, {
selectable: false,
layerName: 'Tool',
});
node.add(portTemplate);
return node;
}
When I create a new link, it’s perfect :

But when I move the link to another port, it’s the “magenta” rectangle :
