Moving node that has link with points and events

So I have a node with a link to it that has points. When I move the node I get the SelectionMoved event but the collection doesn’t include the link. I also have LinkReshaped and LinkRelinked listeners and they don’t fire when moving the node. I need to update the points on our data object when this occurs to update our properties on the data object. I can’t find an event that fires when a link’s points have changed. Any ideas?

Well, the easy thing to do is to add a TwoWay Binding on Link.points:
…linkTemplate =
$(go.Link,
new go.Binding(“points”, “points”).makeTwoWay(),
. . .);
Several of the samples demonstrate this, usually because the User is allowed to reshape the link and the sample wants to remember the link’s new route.

But if you don’t allow the user to reshape links, why do you need to remember the route? Let the implementation of the Link figure it out – it doesn’t need to be saved.

This would be a nice enhancement for GoJS but don’t know how hard it would be.

Our current application defines only the midpoints of links whereas GoJS has start, midpoints, and end. So a link with 2 segments, our app stores 1 point and GoJS 3 points. While customers transfer over to the new web-based app they might want to run the current app for a while. This is going to be tough as some links could be saved with current app, and others with new GoJS app.

How hard would it be to add an option on the Diagram (or Link) that points only define midpoints and not start and stop? Since links currently use fromNode and toNode when there aren’t points, the new option would still use them and drop to the midpoints. You can default this option so existing users aren’t affected with broken code.

Simon gave me a workaround in email, but once we do this and save, then our old app is broken. If this would be an easy enhancement we would benefit greatly from it.

Thanks!

BTW walter I made my post before I saw your reply. I’ll look into your response on the original subject of this thread.

To add the original post we do allow reshaping.

    template = make('Link',
        {
            routing: go.Link.Normal,
            resegmentable: true,
            reshapable: true,
            adjusting: go.Link.End
        },
        new go.Binding('points', 'points'),
        make('Shape',
            {
                strokeWidth: 2
            }
        ),
        make('Shape',
            {
                toArrow: 'Standard'
            }
        )
    );

Instead of using a TwoWay Binding on “points”, I suggest you just keep a “midpoint” data property on the link data.

Implement an “InitialLayoutCompleted” DiagramEvent listener that runs through all of the link data, inserting the “midpoint” into the route, by copying the existing Link.points, inserting the extra Point, and then setting Link.points. When loading by replacing the Diagram.model, do what you would normally do to restore everything but the link routes. Then your “InitialLayoutCompleted” DiagramEvent listener will fix all the link routes by making use of the saved midpoint data.

When saving, first iterate through the Links to set the “midpoint” property to be the mid Point. Then you can do whatever you would normally do for saving the model.