About curved Bezier link

Curved Bezier link, use mouse we can change the two guide points to adjust curviness, good, but
add (comment out) this fromSpot and toSpot,
fromSpot: go.Spot.Right, toSpot: go.Spot.Left,
line 29

then the two guide points are gone, I can’t change the curviness,

why it don’t work?

By specifying a link connection spot at an end of a link (either directly on the Link or defaulting to the spot value at the GraphObject port) you are saying that there should be an “end segment” coming out or going into that spot at an appropriate angle. Specifying a segment takes up an extra point, so that takes away the use of that point as a Bezier control point. Specifying end segments at both ends of the link means there cannot be any control points at all. At least not with the default routing.

You could do your own routing and form poly-Bezier curves or whatever you want. For example, see the routing created by LayeredDigraphLayout: Beat Paths

I don’t want to make a curves link programmatically, I just want to control point out here

you mean Bezier line need 4 points, there is only 2 point so the control points are gone?

then look when
I set “draggingTool.dragsLink”: true,
then drag out the link to no link to any object the control points came back, how to explain this.

They aren’t connected with any ports that have fromSpot or toSpot. If you have any Nodes that don’t have spots and connect the link with it or them, they might retain the control point handle(s).

Please look at this sample there is no control point draggable.

Becouse of I set the
fromSpot: go.Spot.Right, toSpot: go.Spot.Left,

I think it is possible to show the control points,
even I set fromSpot: go.Spot.Right, toSpot: go.Spot.Left,

or it has shown the control points it hides behind the start point or end point ?

I’m not sure why you cannot reconnect dragged links to nodes. Maybe because you set the portGravity to zero? Try a small value such as 20.

But then when you do reconnect a link, I notice that the control point handles do remain visible. That seems like a bug to me, although that is exactly what you want, isn’t it?

Yes, I want to move the control point, even at fromSpot: go.Spot.Right, toSpot: go.Spot.Left is are setting.
the problem is when I setting the fromSpot or toSpot, I can’t move the control points, it not visible or hidden.

I just want to change the curves by control points. no matter fromSpot or toSpot setting or not.

by the way, I add these to diagram settings, so the free links can reconnect to the objects again.
It is not a bug I think.
“linkingTool.isUnconnectedLinkValid”: true,
“relinkingTool.isUnconnectedLinkValid”: true,

look this.

This requires customizing the LinkReshapingTool so that it creates those reshaping handles. I’m not sure how much work that is. I’ll try later when I get some free time.

Here’s an override of LinkReshapingTool.makeAdornment that you can try, in the initialization of your Diagram:

  $(go.Diagram, ...,
      {
          "linkReshapingTool.makeAdornment": function(path) {
            var ad = go.LinkReshapingTool.prototype.makeAdornment.call(this, path);
            var link = path.part;
            if (link.computeCurve() !== go.Link.Bezier) return ad;
            if (!link.computeSpot(true).equals(go.Spot.None)) {
              var h = this.makeHandle(path, 1);
              h.segmentIndex = 1;
              this.setReshapingBehavior(h, go.LinkReshapingTool.All);
              h.cursor = 'move';
              ad.add(h);
            }
            if (!link.computeSpot(false).equals(go.Spot.None)) {
              var h = this.makeHandle(path, link.pointsCount-2);
              h.segmentIndex = link.pointsCount-2;
              this.setReshapingBehavior(h, go.LinkReshapingTool.All);
              h.cursor = 'move';
              ad.add(h);
            }
            return ad;
          },
          . . .
      })

I tested on jsfiddle no problem! Thank you!
this is Solution.

BTW.

but when i move the objects the curviness will reset. this is not problem for me.

port edge from the shape the curviness will keep, when move the object.

Maybe you want to set Link.adjusting

I set all these to adjusting
go.Link.None, End, Scale, or Stretch.

but still reset the curviness.

Is your layout routing the links?

[EDIT:] It’s because the fromSpot and/or toSpot are specific or sided Spots. That affects the routing, causing the automatic maintenance of the routing via Link.adjusting to be preempted.

Maybe you should customize the LinkReshapingTool to set Link.fromSpot and Link.toSpot back to go.Spot.Default in an override of LinkReshapingTool.doActivate. Call the super method first.

I want to say, I am adjusting the link like this
image

and I move the object “Shopping” it will reset all link line to almost no Curve
image

refer

I updated my response before you posted…

Oh yes, Customize the LinkReshapingTool
Let me try. Is there any sample customizing LinkReshapingTool?

I will refer this to try.
Thank you.

I just gave you an example, the Solution to this topic’s question.

you mean
LinkReshapingTool.makeAdornment
example?
yes, it works perfectly, thank you.