Link gradient inverted

I use a gradient brush on my link, it use the color of the two ports connected :

If I move the left module below the right module, the gradient is inverted…

If I move the left to his initial position the gradient is inverted to the correct values.

Why ??

Sorry about that – clearly a bug in the GradientLink’s calculation of the Linear gradient Brush that I made when in a hurry to try to answer everyone. You have the code so you should be able to debug it.

Ok do you think to fix this in the next release ? I dont know how to correct it. I suppose I must get the link direction and change the brush gradient order…

I cannot reproduce any problem with GradientLink.
http://gojs.net/extras/GradientLink.html

A simpler example with the issue :

getLinkTemplate() {
  return this.go(go.Link,
    this.go(go.Shape,
      {
        stroke: this.go(go.Brush, 'Linear', {
          0.0: '#FF0000',
          1.0: '#0000FF',
        }),
      },
    ),
  );
}

That won’t work. Use the GradientLink class defined in http://gojs.net/extras/GradientLink.html.