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:

Members

allowRotation :boolean

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.
Type:
  • boolean
Source:

allowScale :boolean

Is set to true allow the viewport to be scalled. Scaling is performed using the pointer scroll.
Type:
  • boolean
Source:

dragButton :number

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

moveOnScale :boolean

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.
Type:
  • boolean
Source:

rotationInitial :number

Initial rotation of the viewport.
Type:
  • number
Source:

rotationPoint :Vector2|null

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

viewport :Viewport

Viewport being controlled by this object.
Type:
Source:

Methods

update(pointer)

Update the viewport controls using the pointer object. Should be called every frame before rendering.
Parameters:
Name Type Description
pointer Pointer Pointer used to control the viewport.
Source: