This sample demonstrates a custom Tool, LinkLabelOnPathDraggingTool, that allows the user to drag the label of a Link, but that keeps the label exactly on the path of the link. The tool is defined at LinkLabelOnPathDraggingTool.ts.

The label on the link can be any arbitrarily complex object. It is positioned by the GraphObject.segmentIndex and GraphObject.segmentFraction properties, which are set by the LinkLabelOnPathDraggingTool. TwoWay Bindings on those two properties automatically remember any modified values on the link data object in the model.

The tool is derived from a similar tool, LinkLabelDraggingTool.ts, that allows the user to drag the label in any direction from the mid-point of the Link path.