LinkReshapingTool does not remove straight lines in some cases

When I move resegmentation handle, straight lines are removed. But if I move reshaping handle, straight lines are sometimes remain.

See this video from the sample page:

I expect straight line to be removed at 0:08 point in the video when I move the top handle, as the same line is removed at 0:12 point after moving the bottom handle.

In my project it reproduces with 3.0.27 version, Orthogonal routing and go.LinkReshapingTool.

Yes, that is intentional – only resegmenting handles might increase the number of segments.

1 Like

The problem is not with increasing the number of segments. It is with the way LinkReshapingTool removes unneded segments. If resegmentingDistance is set it removes segments that form a straight line.

But in the video you can see that it does that only when moving one points, but not the others. I move reshaping handles in both scenarios and produce the same end result at 0:08 and at 0:12, but in one case segment is removed (0:12, bottom handle), and in another one it stays (0:08, top handle).

I expect the behavior to be the same in both scenarios and the segment to be removed.

I had originally written that only the resegmenting handles change the number of segments, but that’s clearly not true when reshapable is true and dragging a reshaping handle – the number of segments may decrease then. So I changed what I wrote to say that dragging a resegmenting handle may increase the number of segments, implying that dragging either a reshaping or a resegmenting handle may decrease the number of segments.

I suppose the LinkReshapingTool could be smarter, but it isn’t at the moment. I’m working on the other problem, involving inserting a lot of points.

Got it, thanks for the explanation. For now I’m cleaning up those points in my custom SnapLinkReshapingTool’s doDeactivate. Would be nice to have this built-in in the future.