# Class SnapLinkReshapingTool

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

- LinkReshapingTool
  - SnapLinkReshapingTool

The SnapLinkReshapingTool class lets the user snap link reshaping handles to the nearest grid point. If avoidsNodes is true and the link is orthogonal, it also avoids reshaping the link so that any adjacent segments cross over any avoidable nodes.

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

#####
Index

### Constructors

constructor

### Accessors

avoidsNodes
gridCellSize
gridOrigin
isGridSnapEnabled

### Methods

computeReshape
doActivate

#####
Inherited Index

### Accessors

LinkReshapingTool.adornedLink
LinkReshapingTool.handle
LinkReshapingTool.handleArchetype
LinkReshapingTool.midHandleArchetype
LinkReshapingTool.originalPoint
LinkReshapingTool.originalPoints
LinkReshapingTool.resegmentingDistance
Tool.diagram
Tool.isActive
Tool.isEnabled
Tool.name
Tool.transactionResult

### Methods

LinkReshapingTool.canStart
LinkReshapingTool.doCancel
LinkReshapingTool.doDeactivate
LinkReshapingTool.doMouseMove
LinkReshapingTool.doMouseUp
LinkReshapingTool.getReshapingBehavior
LinkReshapingTool.reshape
LinkReshapingTool.setReshapingBehavior
LinkReshapingTool.stopTransaction
LinkReshapingTool.updateAdornments
Tool.canStartMultiTouch
Tool.cancelWaitAfter
Tool.doKeyDown
Tool.doKeyUp
Tool.doMouseDown
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

## Constructors

### constructor

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

- #### Parameters

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

  #### Returns SnapLinkReshapingTool

## Accessors

### avoidsNodes
: boolean

- Gets or sets whether a reshape handle's position should only be dragged where the adjacent segments do not cross over any nodes. This affects the behavior of computeReshape.

  The default value is true.

### gridCellSize
: Size

- Gets or sets the go.Size of each grid cell to which link points will be snapped.

  The default value is NaNxNaN, which means use the go.Diagram.grid's go.Panel.gridCellSize.

### gridOrigin
: Point

- Gets or sets the go.Point origin for the grid to which link points will be snapped.

  The default value is NaN,NaN, which means use the go.Diagram.grid's go.Panel.gridOrigin.

### isGridSnapEnabled
: boolean

- Gets or sets whether a reshape handle's position should be snapped to a grid point. This affects the behavior of computeReshape.

  The default value is true.

## Methods

### `Override` computeReshape

- computeReshape(p: Point): Point

- Pretend while dragging a reshape handle the mouse point is at the nearest grid point, if isGridSnapEnabled is true. This uses gridCellSize and gridOrigin, unless those are not real values, in which case this uses the go.Diagram.grid's go.Panel.gridCellSize and go.Panel.gridOrigin.

  If avoidsNodes is true and the adorned Link is go.Link.isOrthogonal, this method also avoids returning a Point that causes the adjacent segments, both before and after the current handle's index, to cross over any Nodes that are go.Node.avoidable.

  #### Parameters

  - ##### p: Point

  #### Returns Point

### `Override` doActivate

- doActivate(): void

- This override records information about the original point of the handle being dragged, if the adornedLink is Orthogonal and if avoidsNodes is true.

  #### Returns void

Copyright © 1998-2024 by Northwoods Software Corporation.