# Class LinkShiftingTool

GoJS® Diagramming Components
version 3.0.7
by Northwoods Software®

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. See the Extensions intro page for more information.

#### Hierarchy

- 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.

#####
Index

### Constructors

constructor

### Accessors

fromHandleArchetype
toHandleArchetype

### Methods

canStart
doActivate
doCancel
doDeactivate
doMouseMove
doMouseUp
doReshape
doStop
updateAdornments

#####
Inherited Index

### Accessors

Tool.diagram
Tool.isActive
Tool.isEnabled
Tool.name
Tool.transactionResult

### Methods

Tool.canStartMultiTouch
Tool.cancelWaitAfter
Tool.doKeyDown
Tool.doKeyUp
Tool.doMouseDown
Tool.doMouseWheel
Tool.doStart
Tool.doWaitAfter
Tool.findToolHandleAt
Tool.isBeyondDragSize
Tool.standardMouseClick
Tool.standardMouseOver
Tool.standardMouseSelect
Tool.standardMouseWheel
Tool.standardPinchZoomMove
Tool.standardPinchZoomStart
Tool.standardWaitAfter
Tool.startTransaction
Tool.stopTool
Tool.stopTransaction

## Constructors

### constructor

- new LinkShiftingTool(init?: Partial<LinkShiftingTool>): LinkShiftingTool

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

  #### Parameters

  - ##### `Optional` init: Partial<LinkShiftingTool>

  #### Returns LinkShiftingTool

## Accessors

### fromHandleArchetype
: GraphObject

- A small GraphObject used as a shifting handle.

### toHandleArchetype
: GraphObject

- A small GraphObject used as a shifting handle.

## Methods

### `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

- 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.

  #### Parameters

  - ##### pt: Point

  #### Returns void

### `Override` doStop

- doStop(): void

- Perform cleanup of tool state.

  #### Returns void

### `Override` updateAdornments

- updateAdornments(part: Part): void

- Show an go.Adornment with a reshape handle at each end of the link which allows for shifting of the end points.

  #### Parameters

  - ##### part: Part

  #### Returns void

Copyright © 1998-2024 by Northwoods Software Corporation.