Hi GoJS team,
I’m looking for an advice because you’ve probably encountered similar problems (couldn’t find my exact problem on this forum though).
I use curve: Link.Bezier
, bind points
and do not specify any ports on nodes. I save points to a database and retrieve it so that user can create even more custom shape of their link on a diagram.
My diagram is using TreeLayout
and GraphLinksModel
. Nodes are being added to a diagram, some of them can be moved but only some of the nodes would have position
saved.
My problem is that points are absolutely positioned and certain operations on a diagram may render them not pointing to an original node. Adding, removing, moving nodes, basically anything which in result would move the node around. It’s a multi-user environment so that change may be done by others and we may “download” it. Points have first (P0) and last point (P3) on the from
and to
node which may have moved.
I’m not sure if I’m using the wrong thing here (points) and there’s a better way or should I just react on many possible events on a diagram and… allow go.js to calculate points again? But will it, given user changed them previously? I’m afraid that there will be a version of a diagram (without some of the nodes because filtering or user-access needs to be taken into account) that these points will be irrelevant as well.
So I’m probably asking if there’s a way in go.js to store P1 and P2 control points of a Bezier curve and leave P0 and P3 to be determined by go.js because it knows from
and to
node and their position on a diagram after layout. Or should I calculate P0, P3 myself at some point after the layout of a diagram?Is that what people do in such scenarios? Is there a method inside the library which would determine crossing point between node bounds and link taking fromShortLength
, toShortLength
, toEndSegmentLength
, fromEndSegmentLength
. I would gladly use something from the inner of a library to avoid any possible discrepancy between my calculations and go.js’
Not sure if the above makes sense but I’m looking for something like curviness
but with two guiding points which would work regardless of the node position.
Thanks for any advice!