How to set geometryString of the line2


#1

The sample show the Line1 source code.https://gojs.net/latest/samples/relationships.html
How to set Line2 with the geometryString?


#2

Well, the obvious answer would be to just set tne Shape.geometryString of the Link.path.

But that won’t work if either connected Node is moved or changes size, since then the Geometry would no longer be suitable for that Link.

So the correct solution is to override Link.makeGeometry. There are at least three samples that demonstrate overriding that method.

Remember that the route for a link is a series of Points in document coordinates – the Link.points, which is computed automatically by Link.computePoints based on various Link properties including the locations of the connected ports. The geometry for a link path is computed automatically from the route by Link.makeGeometry based on the value of Link.points and a few Link properties. That Geometry is then assigned to all of the main elements of the Link, including the Link.path. And the points used in a Geometry, its PathFigure and its PathSegments are all in its own local coordinates.