BUG: Error from LinkingTool.doActivate


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:

It happened after reshaping the link. Most of the times the bug will not occur, but after several reshapings the error is thrown.

fh.prototype.doActivate = function() {
  var a = this.g;
  if (null !== a && (this.Yb = this.findToolHandleAt(a.vc.da, this.name), null !== this.Yb)) {
    var b = this.Yb.T.Mh;
    if (b instanceof W) {
      this.bx = b;
      a.Ge = !0;
      if (b.jt && .5 === this.Yb.Dw) {
        var c = b.points.copy(),
          d = this.Yb.mb(Ib);
        c.Zd(this.Yb.Pf + 1, d);
        b.dc && c.Zd(this.Yb.Pf + 1, d);
        b.points = c;
        this.Yb = this.findToolHandleAt(a.vc.da, this.name)
      this.RB = b.l(this.Yb.Pf); // This is the line that causes the error
      this.ny = b.points.copy();
      this.oa = !0


Ps: Is there a particular way to report bugs or do we have to post them here on the forum?

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.

Reporting bugs either here or by e-mail is fine.

i’m using version 1.5.13

I indeed have the link.adjusting property set (to go.Link.Stretch). I’ll update to > 1.5.20.

Thanks for the quick reply


I updated go to 1.5.22 but the bug still occured. Then i disabled the adjusting but that also did not fix the problem.

Sorry about the delay in responding, but when you edited your post I did not notice that you had responded.

OK, so it isn’t the (already fixed) problem that I was guessing it was. Is there any way you can help us reproduce the problem?

Hi Walter,

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.


I still cannot reproduce the problem.

One thing that we are fixing in version 1.5.23 is to allow tool handles to be Panels. However you already know about that (Where to override redrawing a link when one of its linked nodes is moved), and that situation does not apply to the existing PolylineLinkingTool sample in which you demonstrated the bug.

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.

Hi Walter,

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.)

In version 1.6 (http://gojs.net/beta) we have made the code calling Tool.findToolHandleAt more robust, handling the case where it (unexpectedly) returns null. We haven’t put out a new 1.5.23 yet, so http://gojs.net/latest doesn’t (yet) have this. But we will.

OK, if you aren’t using 1.6.*, try using 1.5.23: GoJS version 1.5.23

Hi Walter,

It looks like it’s fixed! i haven’t been able to reproduce the bug. and setting panels as tool handles also works perfectly.