Customize arrowhead direction?

Hi, we have overridden Link.prototype.makeGeometry in order to make custom paths for links. That works well enough, but arrowhead orientation is a bit askew. It appears arrowheads are taking a linear direction from last two points, which is at least an understandable best guess, but still not quite right.

Arrowheads are coming from the standard approach about like this…

diagram.linkTemplate = 
  $(CustomLink, // subclass of go.Link 
    ...
    $(go.Shape, { toArrow: "Standard" }, ...)
  );

Is there any nice way to specify the correct arrowhead direction, e.g., with a binding on that shape?

As a workaround, we could put the arrowhead shape in its own panel and position with segmentIndex/segmentFraction/segmentOffset etc and specify an angle, but it would be preferable to avoid all that if possible.

As GoJS Link Labels -- Northwoods Software demonstrates, the Shape.toArrow property is just a short-cut for setting several properties, as shown in that example at the end of the page.

So you can add your own Binding(s) on some or all of those properties, if you like.

But the right way to fix that would be to override the undocumented method Link.computeAngle.

function CustomLink() {
  go.Link.call(this);
}
go.Diagram.inherit(CustomLink, go.Link);

CustomLink.prototype.computeAngle = function(elt, orient, angle) {
  if (elt.segmentIndex !== -1) return go.Link.prototype.computeAngle.call(this, elt, orient, angle);
  return ???
}

Yes, that’s what I’m looking for. Thanks.