Skip to content

Commit 4115b10

Browse files
committed
Added jsdocs
1 parent 285b811 commit 4115b10

1 file changed

Lines changed: 43 additions & 25 deletions

File tree

src/input/touch/TouchManager.js

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ var Class = require('../../utils/Class');
1010
// https://patrickhlauke.github.io/touch/tests/results/
1111
// https://www.html5rocks.com/en/mobile/touch/
1212

13-
/**
14-
* @callback TouchHandler
15-
*
16-
* @param {TouchEvent} event - [description]
17-
*/
18-
1913
/**
2014
* @classdesc
21-
* [description]
15+
* The Touch Manager is a helper class that belongs to the Input Manager.
16+
*
17+
* Its role is to listen for native DOM Touch Events and then pass there onto the Input Manager for further processing.
18+
*
19+
* You do not need to create this class directly, the Input Manager will create an instance of it automatically.
2220
*
2321
* @class TouchManager
2422
* @memberOf Phaser.Input.Touch
2523
* @constructor
2624
* @since 3.0.0
2725
*
28-
* @param {Phaser.Input.InputManager} inputManager - [description]
26+
* @param {Phaser.Input.InputManager} inputManager - A reference to the Input Manager.
2927
*/
3028
var TouchManager = new Class({
3129

@@ -34,7 +32,7 @@ var TouchManager = new Class({
3432
function TouchManager (inputManager)
3533
{
3634
/**
37-
* [description]
35+
* A reference to the Input Manager.
3836
*
3937
* @name Phaser.Input.Touch.TouchManager#manager
4038
* @type {Phaser.Input.InputManager}
@@ -53,7 +51,8 @@ var TouchManager = new Class({
5351
this.capture = true;
5452

5553
/**
56-
* [description]
54+
* A boolean that controls if the Touch Manager is enabled or not.
55+
* Can be toggled on the fly.
5756
*
5857
* @name Phaser.Input.Touch.TouchManager#enabled
5958
* @type {boolean}
@@ -63,30 +62,23 @@ var TouchManager = new Class({
6362
this.enabled = false;
6463

6564
/**
66-
* [description]
65+
* The Touch Event target, as defined in the Game Config.
66+
* Typically the canvas to which the game is rendering, but can be any interactive DOM element.
6767
*
6868
* @name Phaser.Input.Touch.TouchManager#target
69-
* @type {null}
69+
* @type {any}
7070
* @since 3.0.0
7171
*/
7272
this.target;
7373

74-
/**
75-
* [description]
76-
*
77-
* @name Phaser.Input.Touch.TouchManager#handler
78-
* @type {?TouchHandler}
79-
* @since 3.0.0
80-
*/
81-
this.handler;
82-
8374
inputManager.events.once('boot', this.boot, this);
8475
},
8576

8677
/**
87-
* [description]
78+
* The Touch Manager boot process.
8879
*
8980
* @method Phaser.Input.Touch.TouchManager#boot
81+
* @private
9082
* @since 3.0.0
9183
*/
9284
boot: function ()
@@ -108,6 +100,14 @@ var TouchManager = new Class({
108100
}
109101
},
110102

103+
/**
104+
* The Touch Start Event Handler.
105+
*
106+
* @method Phaser.Input.Touch.TouchManager#onTouchStart
107+
* @since 3.10.0
108+
*
109+
* @param {TouchEVent} event - The native DOM Touch Start Event.
110+
*/
111111
onTouchStart: function (event)
112112
{
113113
if (event.defaultPrevented)
@@ -124,6 +124,14 @@ var TouchManager = new Class({
124124
}
125125
},
126126

127+
/**
128+
* The Touch Move Event Handler.
129+
*
130+
* @method Phaser.Input.Touch.TouchManager#onTouchMove
131+
* @since 3.10.0
132+
*
133+
* @param {TouchEVent} event - The native DOM Touch Move Event.
134+
*/
127135
onTouchMove: function (event)
128136
{
129137
if (event.defaultPrevented)
@@ -140,6 +148,14 @@ var TouchManager = new Class({
140148
}
141149
},
142150

151+
/**
152+
* The Touch End Event Handler.
153+
*
154+
* @method Phaser.Input.Touch.TouchManager#onTouchEnd
155+
* @since 3.10.0
156+
*
157+
* @param {TouchEVent} event - The native DOM Touch End Event.
158+
*/
143159
onTouchEnd: function (event)
144160
{
145161
if (event.defaultPrevented)
@@ -157,9 +173,10 @@ var TouchManager = new Class({
157173
},
158174

159175
/**
160-
* [description]
176+
* Starts the Touch Event listeners running.
161177
*
162178
* @method Phaser.Input.Touch.TouchManager#startListeners
179+
* @private
163180
* @since 3.0.0
164181
*/
165182
startListeners: function ()
@@ -184,9 +201,10 @@ var TouchManager = new Class({
184201
},
185202

186203
/**
187-
* [description]
204+
* Stops the Touch Event listeners.
188205
*
189206
* @method Phaser.Input.Touch.TouchManager#stopListeners
207+
* @private
190208
* @since 3.0.0
191209
*/
192210
stopListeners: function ()
@@ -199,7 +217,7 @@ var TouchManager = new Class({
199217
},
200218

201219
/**
202-
* [description]
220+
* Destroys this Touch Manager instance.
203221
*
204222
* @method Phaser.Input.Touch.TouchManager#destroy
205223
* @since 3.0.0

0 commit comments

Comments
 (0)