Bezier curve links with binding to visibility and points - inconsistent binding?

Hi Go.js Team,

I wanted to ask an opinion on the thing I’m trying to achieve. Any help/pointers would be appreciated, thanks!

I’m using Bezier curve for links and I’m binding points and visibility to data coming from my app. Once the user changes the bend of the link, I save the value to recreate it next time they visit diagram. Works just fine.

We’ve also introduced custom filters and bound visibility of these links to filters settings. We can filter multiple things ranging from elements of nodes, certain nodes, but also links.

What I’m seeing right now is that if I filter links and bring them back, they come without any curviness as would be set by points. Before binding, points have the exact values which are needed to recreate their shape.

If I filter other things (nodes content, node types), links bind themselves again correctly to the set points.

Changing those filters would save them to modelData (accessible to binding) and each change would issue:

diagram.value?.updateAllRelationshipsFromData();
diagram.value?.updateAllTargetBindings();

It looks like we have an error on our side but I wanted to ask cause maybe I misunderstood something.

Is setting binding to both “points” and “visibility” problematic here? Or perhaps I should look elsewhere in the binding space to understand this behaviour and correct it to expected?

Any help would be appreciated, thanks! I may provide more context on this if needed.

Few properties from link template that may be important:

curve: Link.Bezier,
relinkableFrom: false,
relinkableTo: false,
resegmentable: false,
isLayoutPositioned: false,
isTreeLink: false,
selectionAdorned: false,
deletable: false,

new Binding('points', 'points'),
new Binding('visible', '', (model, object) => {
    const link = object.part.data;
    const filter = findItemByName('Links', model.filters);
    if (filter) {
       return filter.status && link.status !== "archived";
    }
    return false;
  }).ofModel(),

It’s often better to bind opacity. If you want to “filter” the link, you can set its opacity to 0, and possibly set pickable to false. Doing this via binding is fine.

Thanks a lot! I wouldn’t think of that! Works!

Do you perhaps have an explanation as to why it behaves differently than visibility?

When changing visibility, Parts may need to remeasure or rearrange and can also impact things like layouts.

See the API docs for GraphObject.visible, GraphObject.opacity for a bit more explanation.

That being said, I was very happy to see it working on my limited and stripped down example but when I put in the wider context, I have some filters triggering correctly those points and opacity, others not so much so I guess search continues. It’s still better than before!

I don’t know about that, but you also might want to set selectable to false as well, so that the selectAll command or rubber band selection doesn’t include those hidden links.

Ah, great point, thanks!