• Public
  • Public/Protected
  • All

Class LinkShiftingTool

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. Extensions can be found in the GoJS kit under the extensions or extensionsTS folders. See the Extensions intro page for more information.


  • Tool
    • LinkShiftingTool

The LinkShiftingTool class lets the user shift the end of a link to be anywhere along the edges of the port; use it in a diagram.toolManager.mouseDownTools list:

myDiagram.toolManager.mouseDownTools.add(new LinkShiftingTool());

If you want to experiment with this extension, try the Link Shifting sample.




  • Constructs a LinkShiftingTool and sets the handles and name of the tool.

    Returns LinkShiftingTool


fromHandleArchetype : GraphObject

  • A small GraphObject used as a shifting handle.

toHandleArchetype : GraphObject

  • A small GraphObject used as a shifting handle.


Override canStart

  • canStart(): boolean
  • This tool may run when there is a mouse-down event on a reshaping handle.

    Returns boolean

Override doActivate

  • doActivate(): void
  • Start shifting, if findToolHandleAt finds a reshaping handle at the mouse down point.

    If successful this sets the handle to be the reshape handle that it finds. It also remembers the original points in case this tool is cancelled. And it starts a transaction.

    Returns void

Override doCancel

  • doCancel(): void
  • Restore the link route to be the original points and stop this tool.

    Returns void

Override doDeactivate

  • doDeactivate(): void
  • This stops the current shifting operation with the link as it is.

    Returns void

Override doMouseMove

  • doMouseMove(): void
  • Call doReshape with a new point determined by the mouse to change the end point of the link.

    Returns void

Override doMouseUp

  • doMouseUp(): void
  • Reshape the link's end with a point based on the most recent mouse point by calling doReshape, and then stop this tool.

    Returns void


  • doReshape(pt: Point): void
  • Find the closest point along the edge of the link's port and shift the end of the link to that point.


    Returns void

Override doStop

  • doStop(): void
  • Perform cleanup of tool state.

    Returns void

Override updateAdornments

  • updateAdornments(part: Part): void
  • Show an Adornment with a reshape handle at each end of the link which allows for shifting of the end points.


    Returns void