# Class PolylineLinkingTool

GoJS® Diagramming Components
version 3.0.14
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

- LinkingTool
  - PolylineLinkingTool

The PolylineLinkingTool class the user to draw a new go.Link by clicking where the route should go, until clicking on a valid target port.

This tool supports routing both orthogonal and straight links. You can customize the go.LinkingBaseTool.temporaryLink as needed to affect the appearance and behavior of the temporary link that is shown during the linking operation. You can customize the go.LinkingTool.archetypeLinkData to specify property values that can be data-bound by your link template for the Links that are actually created.

If you want to experiment with this extension, try the Polyline Linking sample.

#####
Index

### Constructors

constructor

### Methods

doActivate
doKeyDown
doMouseDown
doMouseMove
doMouseUp
insertLink

#####
Inherited Index

### Accessors

LinkingBaseTool.isForwards
LinkingBaseTool.isUnconnectedLinkValid
LinkingBaseTool.linkValidation
LinkingBaseTool.linkingCursor
LinkingBaseTool.originalFromNode
LinkingBaseTool.originalFromPort
LinkingBaseTool.originalLink
LinkingBaseTool.originalToNode
LinkingBaseTool.originalToPort
LinkingBaseTool.portGravity
LinkingBaseTool.portTargeted
LinkingBaseTool.targetPort
LinkingBaseTool.temporaryFromNode
LinkingBaseTool.temporaryFromPort
LinkingBaseTool.temporaryLink
LinkingBaseTool.temporaryToNode
LinkingBaseTool.temporaryToPort
LinkingTool.archetypeLabelNodeData
LinkingTool.archetypeLinkData
LinkingTool.direction
LinkingTool.startObject
Tool.diagram
Tool.isActive
Tool.isEnabled
Tool.name
Tool.transactionResult

### Methods

LinkingBaseTool.copyPortProperties
LinkingBaseTool.findTargetPort
LinkingBaseTool.isInSameNode
LinkingBaseTool.isLinked
LinkingBaseTool.isValidCycle
LinkingBaseTool.isValidFrom
LinkingBaseTool.isValidLink
LinkingBaseTool.isValidTo
LinkingBaseTool.setNoTargetPortProperties
LinkingTool.canStart
LinkingTool.doDeactivate
LinkingTool.doNoLink
LinkingTool.findLinkablePort
Tool.canStartMultiTouch
Tool.cancelWaitAfter
Tool.doCancel
Tool.doKeyUp
Tool.doMouseWheel
Tool.doStart
Tool.doStop
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
Tool.updateAdornments

## Constructors

### constructor

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

- Constructs an PolylineLinkingTool, sets portGravity to 0, and sets the name for the tool.

  #### Parameters

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

  #### Returns PolylineLinkingTool

## Methods

### `Override` doActivate

- doActivate(): void

- Use a "crosshair" cursor.

  #### Returns void

### `Override` doKeyDown

- doKeyDown(): void

- This supports the "Z" command during this tool's operation to remove the last added point of the route. Type ESCAPE to completely cancel the operation of the tool.

  #### Returns void

### `Override` doMouseDown

- doMouseDown(): void

- Add a point to the route that the temporary Link is accumulating.

  #### Returns void

### `Override` doMouseMove

- doMouseMove(): void

- Have the temporary link reach to the last mouse point.

  #### Returns void

### `Override` doMouseUp

- doMouseUp(): void

- If this event happens on a valid target port (as determined by go.LinkingBaseTool.findTargetPort), we complete the link drawing operation. insertLink is overridden to transfer the accumulated route drawn by user clicks to the new go.Link that was created.

  If this event happens elsewhere in the diagram, this tool is not stopped: the drawing of the route continues.

  #### Returns void

### `Override` insertLink

- insertLink(fromnode: Node, fromport: GraphObject, tonode: Node, toport: GraphObject): Link

- This method overrides the standard link creation method by additionally replacing the default link route with the custom one laid out by the user.

  #### Parameters

  - ##### fromnode: Node

  - ##### fromport: GraphObject

  - ##### tonode: Node

  - ##### toport: GraphObject

  #### Returns Link

Copyright © 1998-2024 by Northwoods Software Corporation.