Phaser. Pointer

new Pointer(game, id)

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

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 15

Members

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 217

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 61

circle :Phaser.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).

Source - input/Pointer.js, line 245

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 96

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 101

dirty :boolean

A dirty pointer needs to re-poll any interactive objects it may have been over, regardless if it has moved or not.

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

<readonly> duration :number

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

Source - input/Pointer.js, line 816

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 37

game :Phaser.Game

A reference to the currently running game.

Source - input/Pointer.js, line 20

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 25

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 43

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 169

isMouse :boolean

If the Pointer is a mouse this is true, otherwise false.

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

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 175

movementX :number

The horizontal processed relative movement of the Pointer in pixels since last event.

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

movementY :number

The vertical processed relative movement of the Pointer in pixels since last event.

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

msSinceLastClick :number

The number of milliseconds since the last click or touch event.

Source - input/Pointer.js, line 205

pageX :number

The horizontal coordinate of the Pointer relative to whole document.

Source - input/Pointer.js, line 106

pageY :number

The vertical coordinate of the Pointer relative to whole document.

Source - input/Pointer.js, line 111

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 49

position :Phaser.Point

A Phaser.Point object containing the current x/y values of the pointer on the display.

Source - input/Pointer.js, line 228

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 233

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 238

previousTapTime :number

A timestamp representing when the Pointer was last tapped or clicked.

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

rawMovementX :number

The horizontal raw relative movement of the Pointer in pixels since last event.

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

rawMovementY :number

The vertical raw relative movement of the Pointer in pixels since last event.

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

screenX :number

The horizontal coordinate of the Pointer relative to the screen.

Source - input/Pointer.js, line 116

screenY :number

The vertical coordinate of the Pointer relative to the screen.

Source - input/Pointer.js, line 121

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 55

targetObject :any

The Game Object this Pointer is currently over / touching / dragging.

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

timeDown :number

A timestamp representing when the Pointer first touched the touchscreen.

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

timeUp :number

A timestamp representing when the Pointer left the touchscreen.

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

totalTouches :number

The total number of times this Pointer has been touched to the touchscreen.

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

<readonly> type :number

The const type of this object.

Source - input/Pointer.js, line 31

withinGame :boolean

true if the Pointer is over the game canvas, otherwise false.

Source - input/Pointer.js, line 91

<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 837

<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 853

x :number

The horizontal coordinate of the Pointer. This value is automatically scaled based on the game scale.

Source - input/Pointer.js, line 151

y :number

The vertical coordinate of the Pointer. This value is automatically scaled based on the game scale.

Source - input/Pointer.js, line 157

Methods

<internal> addClickTrampoline(name, callback, callbackContext, callbackArgs)

Add a click trampoline to this pointer.

A click trampoline is a callback that is run on the DOM 'click' event; this is primarily needed with certain browsers (ie. IE11) which restrict some actions like requestFullscreen to the DOM 'click' event and reject it for 'pointer' and 'mouse' events.

This is used internally by the ScaleManager; click trampoline usage is uncommon. Click trampolines can only be added to pointers that are currently down.

Parameters:
Name Type Description
name string

The name of the trampoline; must be unique among active trampolines in this pointer.

callback function

Callback to run/trampoline.

callbackContext object

Context of the callback.

callbackArgs Array.<object> | null

Additional callback args, if any. Supplied as an array.

Internal:
  • This member is internal (protected) and may be modified or removed in the future.
Source - input/Pointer.js, line 698

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.

Returns:
boolean -

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

Source - input/Pointer.js, line 666

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.

Returns:
boolean -

true if the Pointer was released within the duration given.

Source - input/Pointer.js, line 682

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 583

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 385

<internal> processInteractiveObjects(fromClick) → {boolean}

Process all interactive objects to find out which ones were updated in the recent Pointer move.

Parameters:
Name Type Argument Default Description
fromClick boolean <optional>
false

Was this called from the click event?

Returns:
boolean -

True if this method processes an object (i.e. a Sprite becomes the Pointers currentTarget), otherwise false.

Internal:
  • This member is internal (protected) and may be modified or removed in the future.
Source - input/Pointer.js, line 473

reset()

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

Source - input/Pointer.js, line 771

resetMovement()

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

Source - input/Pointer.js, line 801

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 271

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 596

update()

Called by the Input Manager.

Source - input/Pointer.js, line 337
Phaser Copyright © 2012-2014 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Tue Jan 06 2015 06:32:15 GMT-0000 (GMT) using the DocStrap template.