I was testing something in our application and i ran into an error. So i checked if it was also present outside our application, in one of the go examples and it is. Here is a screenshot:
What version of GoJS are you using? I suspect this is a bug with link routing when Link.adjusting has been set. Try not setting that in your link template.
That bug was fixed in version 1.5.20. The bug involved a floating-point round-off error, which is why it happened infrequently.
No problem, i wasn’t sure you would get a notification if i edited the post.
Well, before i could reproduce it with this example, with wildly clicking and respaping (as you can see in the image above) but i can’t reproduce it now. I see that the go version in the example has been changed, before it was set to a 1.6 beta version, but now it is using the 1.5.22 version.
I tried several things in my implementation but i’m still getting the bug. I’ll create a codepen to reproduce the problem. At the moment i’m quite busy but i’ll have it ready somewhere next week.
But the minified code that you quoted where the exception happened does point out that if for any reason Tool.findToolHandleAt returns null after a resegmenting, we should not allow the tool to be activated. We can make the code more robust.
I managed to create a codepen example in which you can reproduce the bug. In this case it probably does have something to do with the tool handles, because the bug only occurs if i override the standard handles.
The example is pretty straightforward, in the init function the diagram, templates and model will get instantiated. in the function ‘extendLinkReshapingTool’ i added some extra functionality to the linkReshapingTool. I customized the handles to grow larger when they are entered with the mouse (a workaround for the ‘panels for handles issue’) and i customized the reshape function to make it easier to draw straight lines.
Again, the error occurs irregular when reshaping the line, sometimes after 2 actions and other times it’ll take +20 actions.
I still haven’t been able to reproduce the problem in your CodePen, but it was good to see the customizations that you had done. I am guessing that there is a timing issue with respect to the increasing of the size of a tool handle and the activation of the LinkReshapingTool, which calls Tool.findToolHandleAt a second time when you are trying to resegment. (In other words, there’s no exception when the user drags the tool handles at the link’s route points, but there might be an exception when the user drags the resegmenting tool handle that is at the midpoint of each segment.)