# JSDoc: Class: ViewportControls

# Class: ViewportControls

## ViewportControls(viewport)

#### new ViewportControls(viewport)

Viewport controls are used to allow the user to control the viewport.

##### Parameters:

Name | Type | Description
--- | --- | ---
`viewport` | Viewport |

Source:
  - controls/ViewportControls.js, line 13

### Members

#### allowRotation

If true allows the viewport to be rotated. Rotation is performed by holding the RIGHT and LEFT pointer buttons and rotating around the initial point.

Source:
  - controls/ViewportControls.js, line 46

#### allowScale

Is set to true allow the viewport to be scalled. Scaling is performed using the pointer scroll.

Source:
  - controls/ViewportControls.js, line 32

#### dragButton

Button used to drag and viewport around. On touch enabled devices the touch event is represented as a LEFT button.

Source:
  - controls/ViewportControls.js, line 25

#### moveOnScale

Flag to indicate if the viewport should move when scalling. For some application its easier to focus the target if the viewport moves to the pointer location while scalling.

Source:
  - controls/ViewportControls.js, line 39

#### rotationInitial

Initial rotation of the viewport.

Source:
  - controls/ViewportControls.js, line 58

#### rotationPoint

Value of the initial point of rotation if the viewport is being rotated. Is set to null when the viewport is not being rotated.

Source:
  - controls/ViewportControls.js, line 53

#### viewport

Viewport being controlled by this object.

Source:
  - controls/ViewportControls.js, line 18

### Methods

#### update(pointer)

Update the viewport controls using the pointer object. Should be called every frame before rendering.

##### Parameters:

Name | Type | Description
--- | --- | ---
`pointer` | Pointer |

Source:
  - controls/ViewportControls.js, line 68