mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Added jsdocs
This commit is contained in:
parent
285b811625
commit
4115b10c80
1 changed files with 43 additions and 25 deletions
|
@ -10,22 +10,20 @@ var Class = require('../../utils/Class');
|
|||
// https://patrickhlauke.github.io/touch/tests/results/
|
||||
// https://www.html5rocks.com/en/mobile/touch/
|
||||
|
||||
/**
|
||||
* @callback TouchHandler
|
||||
*
|
||||
* @param {TouchEvent} event - [description]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* [description]
|
||||
* 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 there 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.
|
||||
*
|
||||
* @class TouchManager
|
||||
* @memberOf Phaser.Input.Touch
|
||||
* @constructor
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Input.InputManager} inputManager - [description]
|
||||
* @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager.
|
||||
*/
|
||||
var TouchManager = new Class({
|
||||
|
||||
|
@ -34,7 +32,7 @@ var TouchManager = new Class({
|
|||
function TouchManager (inputManager)
|
||||
{
|
||||
/**
|
||||
* [description]
|
||||
* A reference to the Input Manager.
|
||||
*
|
||||
* @name Phaser.Input.Touch.TouchManager#manager
|
||||
* @type {Phaser.Input.InputManager}
|
||||
|
@ -53,7 +51,8 @@ var TouchManager = new Class({
|
|||
this.capture = true;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* A boolean that controls if the Touch Manager is enabled or not.
|
||||
* Can be toggled on the fly.
|
||||
*
|
||||
* @name Phaser.Input.Touch.TouchManager#enabled
|
||||
* @type {boolean}
|
||||
|
@ -63,30 +62,23 @@ var TouchManager = new Class({
|
|||
this.enabled = false;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* 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.
|
||||
*
|
||||
* @name Phaser.Input.Touch.TouchManager#target
|
||||
* @type {null}
|
||||
* @type {any}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.target;
|
||||
|
||||
/**
|
||||
* [description]
|
||||
*
|
||||
* @name Phaser.Input.Touch.TouchManager#handler
|
||||
* @type {?TouchHandler}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.handler;
|
||||
|
||||
inputManager.events.once('boot', this.boot, this);
|
||||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* The Touch Manager boot process.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#boot
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
boot: function ()
|
||||
|
@ -108,6 +100,14 @@ var TouchManager = new Class({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The Touch Start Event Handler.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#onTouchStart
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {TouchEVent} event - The native DOM Touch Start Event.
|
||||
*/
|
||||
onTouchStart: function (event)
|
||||
{
|
||||
if (event.defaultPrevented)
|
||||
|
@ -124,6 +124,14 @@ var TouchManager = new Class({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The Touch Move Event Handler.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#onTouchMove
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {TouchEVent} event - The native DOM Touch Move Event.
|
||||
*/
|
||||
onTouchMove: function (event)
|
||||
{
|
||||
if (event.defaultPrevented)
|
||||
|
@ -140,6 +148,14 @@ var TouchManager = new Class({
|
|||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* The Touch End Event Handler.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#onTouchEnd
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {TouchEVent} event - The native DOM Touch End Event.
|
||||
*/
|
||||
onTouchEnd: function (event)
|
||||
{
|
||||
if (event.defaultPrevented)
|
||||
|
@ -157,9 +173,10 @@ var TouchManager = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* Starts the Touch Event listeners running.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#startListeners
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
startListeners: function ()
|
||||
|
@ -184,9 +201,10 @@ var TouchManager = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* Stops the Touch Event listeners.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#stopListeners
|
||||
* @private
|
||||
* @since 3.0.0
|
||||
*/
|
||||
stopListeners: function ()
|
||||
|
@ -199,7 +217,7 @@ var TouchManager = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* [description]
|
||||
* Destroys this Touch Manager instance.
|
||||
*
|
||||
* @method Phaser.Input.Touch.TouchManager#destroy
|
||||
* @since 3.0.0
|
||||
|
|
Loading…
Reference in a new issue