# Class PanningTool

GoJS® Diagramming Components
version 3.0.13
by Northwoods Software®

#### Hierarchy

- Tool
  - PanningTool

The PanningTool supports manual panning, where the user can shift the Diagram.position by dragging the mouse.

This tool is a standard mouse-move tool, the ToolManager.panningTool. Although the ToolManager.dragSelectingTool takes precedence over this tool, the DragSelectingTool only starts if there is a delay after a mouse-down event. If it does not start, then this PanningTool gets a chance to start.

This tool does not utilize any Adornments or tool handles. This tool does not modify the model or conduct any transaction.

If you want to programmatically "pan" the diagram, you can just set Diagram.position or call methods such as Diagram.scroll, Diagram.scrollToRect, or Diagram.centerRect.

#####
Index

### Constructors

constructor

### Accessors

bubbles
originalPosition

### Methods

canStart
doActivate
doCancel
doDeactivate
doMouseMove
doMouseUp

#####
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.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 PanningTool(init?: Partial<PanningTool>): PanningTool

- You do not normally need to create an instance of this tool because one already exists as the ToolManager.panningTool.

  The Tool.name of this tool is "Panning".

  #### Parameters

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

  #### Returns PanningTool

## Accessors

### bubbles
: boolean

- Gets or sets whether panning actions will allow events to bubble instead of panning in the diagram.

  Set this to true to allow mobile devices to scroll the page with panning gestures on the diagram. Otherwise, the panning events will be captured and used to pan inside of the diagram.

  The default value is false.

### `Readonly` originalPosition
: Point

- This read-only property returns the Point that was the original value of Diagram.position when the panning operation started.

## Methods

### `Virtual` `Override` canStart

- canStart(): boolean

- This tool can run when the diagram allows scrolling and the mouse has been dragged with the left button far enough away from the mouse-down point to avoid being a click.

  This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

  #### Returns boolean

### `Override` doActivate

- doActivate(): void

- Capture the mouse, change the diagram cursor to "move", and remember the Diagram.position.

  #### Returns void

### `Override` doCancel

- doCancel(): void

- Restore the Diagram.position to what it was when this tool activated.

  #### Returns void

### `Override` doDeactivate

- doDeactivate(): void

- Release the mouse and restore the default diagram cursor.

  #### Returns void

### `Override` doMouseMove

- doMouseMove(): void

- Modify the Diagram.position according to how much the mouse has moved.

  #### Returns void

### `Override` doMouseUp

- doMouseUp(): void

- Modify the Diagram.position according to how much the mouse has moved.

  #### Returns void

Copyright © 1998-2024 by Northwoods Software Corporation.