# JSDoc: Class: Pointer

# Class: Pointer

## Pointer(domElement, canvas)

#### new Pointer(domElement, canvas)

Pointer object is used to colled input from the user, works for booth mouse or touch screens. It is responsible for syncronizing user input with the render of the graphics.

##### Parameters:

Name | Type | Description
--- | --- | ---
`domElement` | DOM | DOM element to craete the pointer events.
`canvas` | DOM | Canvas DOM element where the content is being drawn.

Source:
  - input/Pointer.js, line 16

### Members

#### (static) BACK

Back pointer navigation button.

Source:
  - input/Pointer.js, line 207

#### (static) FORWARD

Forward pointer navigation button.

Source:
  - input/Pointer.js, line 212

#### (static) LEFT

Left pointer button.

Source:
  - input/Pointer.js, line 192

#### (static) MIDDLE

Middle pointer button.

Source:
  - input/Pointer.js, line 197

#### (static) RIGHT

Right pointer button.

Source:
  - input/Pointer.js, line 202

#### canvas

Canvas attached to this pointer instance used to calculate position and delta in element space coordinates.

Source:
  - input/Pointer.js, line 60

#### delta

Pointer movement (coordinates in window space).

Source:
  - input/Pointer.js, line 40

#### domElement

DOM element where to attach the pointer events.

Source:
  - input/Pointer.js, line 55

#### doubleClicked

Indicates a button of the pointer was double clicked.

Source:
  - input/Pointer.js, line 50

#### events

Event manager responsible for updating the raw data variables. Diferent events are used depending on the host platform. When the update method is called the raw data is reset.

Source:
  - input/Pointer.js, line 73

#### keys

Array with pointer buttons status.

Source:
  - input/Pointer.js, line 30

#### position

Pointer position inside of the window (coordinates in window space).

Source:
  - input/Pointer.js, line 35

#### wheel

Pointer scroll wheel movement.

Source:
  - input/Pointer.js, line 45

### Methods

#### (static) buttonDoubleClicked(button) → {boolean}

Check if pointer button was double clicked.

##### Parameters:

Name | Type | Description
--- | --- | ---
`button` | Number | Button to check status of

Source:
  - input/Pointer.js, line 263

##### Returns:

True if some pointer button was just double clicked

Type
  boolean

#### (static) buttonJustPressed(button) → {boolean}

Check if a pointer button was just pressed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`button` | Number | Button to check status of

Source:
  - input/Pointer.js, line 274

##### Returns:

True if button was just pressed

Type
  boolean

#### (static) buttonJustReleased(button) → {boolean}

Check if a pointer button was just released.

##### Parameters:

Name | Type | Description
--- | --- | ---
`button` | Number | Button to check status of

Source:
  - input/Pointer.js, line 285

##### Returns:

True if button was just released

Type
  boolean

#### (static) buttonPressed(button) → {boolean}

Check if pointer button is currently pressed.

##### Parameters:

Name | Type | Description
--- | --- | ---
`button` | Number | Button to check status of

Source:
  - input/Pointer.js, line 252

##### Returns:

True if button is currently pressed

Type
  boolean

#### (static) create()

Create pointer events.

Source:
  - input/Pointer.js, line 392

#### (static) dispose()

Dispose pointer events.

Source:
  - input/Pointer.js, line 400

#### (static) insideCanvas() → {boolean}

Check if pointer is inside attached canvas (updated async).

Source:
  - input/Pointer.js, line 241

##### Returns:

True if pointer is currently inside the canvas

Type
  boolean

#### (static) setCanvas(canvas)

Element to be used for coordinates calculation relative to that canvas.

##### Parameters:

Name | Type | Description
--- | --- | ---
`canvas` | DOM | Canvas to be attached to the Pointer instance

Source:
  - input/Pointer.js, line 219

#### (static) update()

Update pointer buttons state, position, wheel and delta synchronously.

Source:
  - input/Pointer.js, line 334

#### (static) updateKey(button, action)

Update a pointer button. Automatically called by the runtime.

##### Parameters:

Name | Type | Description
--- | --- | ---
`button` | Number |
`action` | Number |

Source:
  - input/Pointer.js, line 323

#### (static) updatePosition(x, y, xDiff, yDiff)

Update pointer position. Automatically called by the runtime.

##### Parameters:

Name | Type | Description
--- | --- | ---
`x` | Number |
`y` | Number |
`xDiff` | Number |
`yDiff` | Number |

Source:
  - input/Pointer.js, line 300