Class: TouchManager

Phaser.Input.Touch. TouchManager

The Touch Manager is a helper class that belongs to the Input Manager.

Its role is to listen for native DOM Touch Events and then pass them onto the Input Manager for further processing.

You do not need to create this class directly, the Input Manager will create an instance of it automatically.


new TouchManager(inputManager)

Parameters:
Name Type Description
inputManager Phaser.Input.InputManager

A reference to the Input Manager.

Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 14)

Members


capture :boolean

If true the DOM events will have event.preventDefault applied to them, if false they will propagate fully.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • true
Source: src/input/touch/TouchManager.js (Line 44)

enabled :boolean

A boolean that controls if the Touch Manager is enabled or not.
Can be toggled on the fly.

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/input/touch/TouchManager.js (Line 54)

manager :Phaser.Input.InputManager

A reference to the Input Manager.

Type:
Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 35)

onTouchCancel :function

The Touch Cancel event handler function.
Initially empty and bound in the startListeners method.

Type:
  • function
Since: 3.15.0
Source: src/input/touch/TouchManager.js (Line 105)

onTouchEnd :function

The Touch End event handler function.
Initially empty and bound in the startListeners method.

Type:
  • function
Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 95)

onTouchMove :function

The Touch Move event handler function.
Initially empty and bound in the startListeners method.

Type:
  • function
Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 85)

onTouchStart :function

The Touch Start event handler function.
Initially empty and bound in the startListeners method.

Type:
  • function
Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 75)

target :any

The Touch Event target, as defined in the Game Config.
Typically the canvas to which the game is rendering, but can be any interactive DOM element.

Type:
  • any
Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 65)

Methods


destroy()

Destroys this Touch Manager instance.

Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 266)

startListeners()

Starts the Touch Event listeners running as long as an input target is set.

This method is called automatically if Touch Input is enabled in the game config,
which it is by default. However, you can call it manually should you need to
delay input capturing until later in the game.

Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 144)

stopListeners()

Stops the Touch Event listeners.
This is called automatically and does not need to be manually invoked.

Since: 3.0.0
Source: src/input/touch/TouchManager.js (Line 249)