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)
name | type | description |
---|---|---|
inputManager | Phaser.Input.InputManager |
A reference to the Input Manager. |
If true the DOM events will have event.preventDefault applied to them, if false they will propagate fully.
A boolean that controls if the Touch Manager is enabled or not. Can be toggled on the fly.
The Touch Cancel event handler function.
Initially empty and bound in the startListeners
method.
The Touch Cancel event handler function specifically for events on the Window.
Initially empty and bound in the startListeners
method.
The Touch End event handler function.
Initially empty and bound in the startListeners
method.
The Touch End event handler function specifically for events on the Window.
Initially empty and bound in the startListeners
method.
The Touch Move event handler function.
Initially empty and bound in the startListeners
method.
The Touch Out event handler function.
Initially empty and bound in the startListeners
method.
The Touch Over event handler function.
Initially empty and bound in the startListeners
method.
The Touch Start event handler function.
Initially empty and bound in the startListeners
method.
The Touch Start event handler function specifically for events on the Window.
Initially empty and bound in the startListeners
method.
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.
Destroys this Touch Manager instance.
Attempts to disable the context menu from appearing if you touch-hold on the browser.
Works by listening for the contextmenu
event and prevent defaulting it.
Use this if you need to disable the OS context menu on mobile.
This Touch Manager instance.
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.
Stops the Touch Event listeners. This is called automatically and does not need to be manually invoked.