# Class: Pointer

## Phaser. Pointer

A Pointer object is used by the Mouse, Touch and MSPoint managers and represents a single finger on the touch screen.

#### new Pointer(game, id)

  Phaser - Pointer constructor.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running game.
  `id` | number | The ID of the Pointer object within the game. Each game can have up to 10 active pointers.

  Source:
    - input/Pointer.js, line 16

### Members

#### active

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `active` | boolean | An active pointer is one that is currently pressed down on the display. A Mouse is always active.

  Default Value:
    - false
  Source:
    - input/Pointer.js, line 218

#### button

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `button` | any | The button property of the Pointer as set by the DOM event when this Pointer is started.

  Default Value:
    - null
  Source:
    - input/Pointer.js, line 62

#### circle

  A Phaser.Circle that is centered on the x/y coordinates of this pointer, useful for hit detection. The Circle size is 44px (Apples recommended "finger tip" size).

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `circle` | Phaser.Circle |

  Source:
    - input/Pointer.js, line 240

#### clientX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `clientX` | number | The horizontal coordinate of the Pointer within the application's client area at which the event occurred (as opposed to the coordinates within the page).

  Source:
    - input/Pointer.js, line 97

#### clientY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `clientY` | number | The vertical coordinate of the Pointer within the application's client area at which the event occurred (as opposed to the coordinates within the page).

  Source:
    - input/Pointer.js, line 102

#### <readonly> duration

  How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `duration` | number | How long the Pointer has been depressed on the touchscreen. If not currently down it returns -1.

  Source:
    - input/Pointer.js, line 669

#### exists

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `exists` | boolean | A Pointer object that exists is allowed to be checked for physics collisions and overlaps.

  Default Value:
    - true
  Source:
    - input/Pointer.js, line 38

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running game.

  Source:
    - input/Pointer.js, line 21

#### id

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `id` | number | The ID of the Pointer object within the game. Each game can have up to 10 active pointers.

  Source:
    - input/Pointer.js, line 26

#### identifier

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `identifier` | number | The identifier property of the Pointer as set by the DOM event when this Pointer is started.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 44

#### isDown

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `isDown` | boolean | If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true.

  Default Value:
    - false
  Source:
    - input/Pointer.js, line 170

#### isMouse

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `isMouse` | boolean | If the Pointer is a mouse this is true, otherwise false.

  Default Value:
    - false
  Source:
    - input/Pointer.js, line 164

#### isUp

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `isUp` | boolean | If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true.

  Default Value:
    - true
  Source:
    - input/Pointer.js, line 176

#### movementX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `movementX` | number | The horizontal processed relative movement of the Pointer in pixels since last event.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 140

#### movementY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `movementY` | number | The vertical processed relative movement of the Pointer in pixels since last event.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 146

#### msSinceLastClick

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `msSinceLastClick` | number | The number of milliseconds since the last click or touch event.

  Source:
    - input/Pointer.js, line 206

#### pageX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `pageX` | number | The horizontal coordinate of the Pointer relative to whole document.

  Source:
    - input/Pointer.js, line 107

#### pageY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `pageY` | number | The vertical coordinate of the Pointer relative to whole document.

  Source:
    - input/Pointer.js, line 112

#### pointerId

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `pointerId` | number | The pointerId property of the Pointer as set by the DOM event when this Pointer is started. The browser can and will recycle this value.

  Default Value:
    - null
  Source:
    - input/Pointer.js, line 50

#### position

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `position` | Phaser.Point | A Phaser.Point object containing the current x/y values of the pointer on the display.

  Source:
    - input/Pointer.js, line 223

#### positionDown

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `positionDown` | Phaser.Point | A Phaser.Point object containing the x/y values of the pointer when it was last in a down state on the display.

  Source:
    - input/Pointer.js, line 228

#### positionUp

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `positionUp` | Phaser.Point | A Phaser.Point object containing the x/y values of the pointer when it was last released.

  Source:
    - input/Pointer.js, line 233

#### previousTapTime

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `previousTapTime` | number | A timestamp representing when the Pointer was last tapped or clicked.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 194

#### rawMovementX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rawMovementX` | number | The horizontal raw relative movement of the Pointer in pixels since last event.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 128

#### rawMovementY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `rawMovementY` | number | The vertical raw relative movement of the Pointer in pixels since last event.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 134

#### screenX

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `screenX` | number | The horizontal coordinate of the Pointer relative to the screen.

  Source:
    - input/Pointer.js, line 117

#### screenY

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `screenY` | number | The vertical coordinate of the Pointer relative to the screen.

  Source:
    - input/Pointer.js, line 122

#### target

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `target` | any | The target property of the Pointer as set by the DOM event when this Pointer is started.

  Default Value:
    - null
  Source:
    - input/Pointer.js, line 56

#### targetObject

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `targetObject` | any | The Game Object this Pointer is currently over / touching / dragging.

  Default Value:
    - null
  Source:
    - input/Pointer.js, line 212

#### timeDown

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `timeDown` | number | A timestamp representing when the Pointer first touched the touchscreen.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 182

#### timeUp

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `timeUp` | number | A timestamp representing when the Pointer left the touchscreen.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 188

#### totalTouches

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `totalTouches` | number | The total number of times this Pointer has been touched to the touchscreen.

  Default Value:
    - 0
  Source:
    - input/Pointer.js, line 200

#### <readonly> type

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `type` | number | The const type of this object.

  Source:
    - input/Pointer.js, line 32

#### withinGame

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `withinGame` | boolean | true if the Pointer is over the game canvas, otherwise false.

  Source:
    - input/Pointer.js, line 92

#### <readonly> worldX

  Gets the X value of this Pointer in world coordinates based on the world camera.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `duration` | number | The X value of this Pointer in world coordinates based on the world camera.

  Source:
    - input/Pointer.js, line 690

#### <readonly> worldY

  Gets the Y value of this Pointer in world coordinates based on the world camera.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `duration` | number | The Y value of this Pointer in world coordinates based on the world camera.

  Source:
    - input/Pointer.js, line 706

#### x

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `x` | number | The horizontal coordinate of the Pointer. This value is automatically scaled based on the game scale.

  Source:
    - input/Pointer.js, line 152

#### y

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `y` | number | The vertical coordinate of the Pointer. This value is automatically scaled based on the game scale.

  Source:
    - input/Pointer.js, line 158

### Methods

#### justPressed(duration) → {boolean}

  The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate. Note that calling justPressed doesn't reset the pressed status of the Pointer, it will return `true` for as long as the duration is valid. If you wish to check if the Pointer was pressed down just once then see the Sprite.events.onInputDown event.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `duration` | number | <optional> | The time to check against. If none given it will use InputManager.justPressedRate.

  Source:
    - input/Pointer.js, line 593

  ##### Returns:

  true if the Pointer was pressed down within the duration given.

  Type
    boolean

#### justReleased(duration) → {boolean}

  The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate. Note that calling justReleased doesn't reset the pressed status of the Pointer, it will return `true` for as long as the duration is valid. If you wish to check if the Pointer was released just once then see the Sprite.events.onInputUp event.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `duration` | number | <optional> | The time to check against. If none given it will use InputManager.justReleasedRate.

  Source:
    - input/Pointer.js, line 609

  ##### Returns:

  true if the Pointer was released within the duration given.

  Type
    boolean

#### leave(event)

  Called when the Pointer leaves the target area.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | PointerEvent | TouchEvent | The event passed up from the input handler.

  Source:
    - input/Pointer.js, line 514

#### move(event, fromClick)

  Called when the Pointer is moved.

  ##### Parameters:

  Name | Type | Argument | Default | Description
  --- | --- | --- | --- | ---
  `event` | MouseEvent | PointerEvent | TouchEvent |  |  | The event passed up from the input handler.
  `fromClick` | boolean | <optional> | false | Was this called from the click event?

  Source:
    - input/Pointer.js, line 351

#### reset()

  Resets the Pointer properties. Called by InputManager.reset when you perform a State change.

  Source:
    - input/Pointer.js, line 625

#### resetMovement()

  Resets the movementX and movementY properties. Use in your update handler after retrieving the values.

  Source:
    - input/Pointer.js, line 654

#### start(event)

  Called when the Pointer is pressed onto the touchscreen.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | any | The DOM event from the browser.

  Source:
    - input/Pointer.js, line 251

#### stop(event)

  Called when the Pointer leaves the touchscreen.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | PointerEvent | TouchEvent | The event passed up from the input handler.

  Source:
    - input/Pointer.js, line 527

#### update()

  Called by the Input Manager.

  Source:
    - input/Pointer.js, line 314