I want to have ports that can be connected by a link, similiar to what is given: Draggable Link
The porst appear only when a mouse enters the node.
However, I don’t want duplicates: Links between the same two ports… However, for some reason my configuration allows this… I’m not sure why.
This is my port configuration:
I’ve tried adding my own node template to the logic circuit example, and it works… hence, the error in my code must be somewhere else…
I think I found the problem while playing with the logical circuit example:
myDiagram.model = go.Model.fromJson(document.getElementById("mySavedModel").value);
myDiagram.model = new go.GraphLinksModel(, );
The upper line loads the data from json which defines linkFromPortIdProperty and linkToPortIdProperty, while the one below doesn’t. The upper one works as in the example, the bottom one causes parallel links to appear.
My question is, should this be the default behaviour?
The default behavior for GraphLinksModel is to not to require each link data object to specify the exact ports with which it should connect. If you want to have multiple ports in your app and if you want that information saved in your model, you’ll need to set at least those two properties in your GraphLinksModel.
Sorry for the late response.
I want to have two ports on my node and to have at most 1 link between two ports. I want to restrict the user from drawing parallel links.
I thought that setting the link properties fromPortId and toPortId would solve my issue… but it doesn’t…
EDIT: I solved it, I was giving the wrong IDs to the before mentioned properties. Thanks for your time and help :-)