I am very impressed by this example Dynamic Ports
But I struggle to adapt it into my code.
As soon as I create a new link, I get this error:
“go.js:14 Uncaught Error: getDocumentPoint:s Spot must be specific: None”
What do I need to set up in oder to make this work?
I copied the whole CustomLink part into my code. I thought it my be an issue with the nodes so I adjusted my nodeTemplate to the one from the example, but it still won’t work.
Any suggestions?
I am still not able to figure out, how the CustomLink works.
Where exactly is spot set?
This line is where I get the error: var thispt = port.getDocumentPoint(this.computeSpot(from));
spot.x and spot.y are both NAN
I also don’t understand when and how often some of these functions are called:
It’s probably because you have not set the fromSpot and toSpot on each port object to specific Spot values.
You could also try to make sure almost everything works without use of the CustomLink class, and only then replace go.Link with CustomLink in your link template.