Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Example of go.Link.computePoints over-ride

$
0
0

@ernestjessee wrote:

Is there on in samples. I am over-riding but things aren't working as expected. What I am trying to do is allow the link to acquire inital points collection from default and then over-ride compute points and immediately call it for a tweak. Perhaps there is something I need to do to have the change displayed?

This may be difficult to understand. NOTE: "$" is this example is jQuery and NOT GOJS. What I am trying to do is have all links headed to the same node make their x-crossover at the same y-point on the screen.

link.computePoints=$.proxy(function(link,arrayOfLinks){
link.startRoute();
link.xMove=null;
var trendSetter;
$.each(arrayOfLinks, $.proxy(function (index, link) {
link.xMove=null;
this.findXMoveForLink(link);
if (!trendSetter || link.xMove.altitude > trendSetter.xMove.altitude) {
trendSetter = link;
}
}, this));

        $.each(link.xMove.points, $.proxy(function (index, point) {
            var newPoint = new go.Point(point.x,trendSetter.xMove.altitude);
            var pointIndex = link.points.toArray().indexOf(point);
            if(pointIndex!=-1){
                link.setPoint(pointIndex,newPoint);
            }


        }, this));
        return true;

    },this,link,arrayOfLinks);

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles