Hey there, People. → LinkShiftingTool
I’ve added the “LinkShifting” Extension that allows users to shift the link to anywhere on the shape using a handle. It’s working as expected but I’m having a slight issue with the position/distance of the handles (on both ends of the link)
Here’s an example image of the problem,
As you can see, the (LinkShiftingTool) handles on both ends are overlapping the re-linking tool’s handles, and I want to avoid that.
Apparently, the position of both the handles of the LinkShiftingTool is somehow linked the the link’s toEndSegmentLength & fromEndSegmentLength properties. But, I don’t want to change them (set to 0).
Look,
Is there any way I can change the position of both the handles of the LinkShiftingTool a bit inwards?
I just want the 2nd image’s behaviour to be played in the 1st image (problem) without the need of changing the toEndSegmentLength & fromEndSegmentLength properties of the Link.
Just for the reference, this is a code snippet from the extension file (LinkShiftingTool.ts),
constructor(init?: Partial<LinkShiftingTool>) {
super();
this.name = "LinkShifting";
const h: go.Shape = new go.Shape();
h.geometryString = "F1 M0 0 L8 0 M8 4 L0 4";
h.fill = null;
h.stroke = "dodgerblue";
h.background = "lightblue";
h.cursor = "pointer";
h.segmentIndex = 0;
h.segmentFraction = 1;
h.segmentOrientation = go.Orientation.Along;
const g: go.Shape = new go.Shape();
g.geometryString = "F1 M0 0 L8 0 M8 4 L0 4";
g.fill = null;
g.stroke = "dodgerblue";
g.background = "lightblue";
g.cursor = "pointer";
g.segmentIndex = -1;
g.segmentFraction = 1;
g.segmentOrientation = go.Orientation.Along;
this._fromHandleArchetype = h;
this._toHandleArchetype = g;
this._originalPoints = null;
this._handle = null;
this._originalPoints = null;
if (init) Object.assign(this, init);
}
Thank you for reading.