You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/input/Input.js
+46Lines changed: 46 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,11 @@ Phaser.Input = function (game) {
31
31
*/
32
32
this.hitContext=null;
33
33
34
+
/**
35
+
* @property {array} moveCallbacks - An array of callbacks that will be fired every time the activePointer receives a move event from the DOM.
36
+
*/
37
+
this.moveCallbacks=[];
38
+
34
39
/**
35
40
* @property {function} moveCallback - An optional callback that will be fired every time the activePointer receives a move event from the DOM. Set to null to disable.
36
41
*/
@@ -390,14 +395,19 @@ Phaser.Input.prototype = {
390
395
this.gamepad.stop();
391
396
// this.gestures.stop();
392
397
398
+
this.moveCallbacks=[];
399
+
// DEPRECATED
393
400
this.moveCallback=null;
394
401
395
402
},
396
403
397
404
/**
405
+
* DEPRECATED: This method will be removed in a future major point release. Please use Input.addMoveCallback instead.
406
+
*
398
407
* Sets a callback that is fired every time the activePointer receives a DOM move event such as a mousemove or touchmove.
399
408
* It will be called every time the activePointer moves, which in a multi-touch game can be a lot of times, so this is best
400
409
* to only use if you've limited input to a single pointer (i.e. mouse or touch)
410
+
*
401
411
* @method Phaser.Input#setMoveCallback
402
412
* @param {function} callback - The callback that will be called each time the activePointer receives a DOM move event.
403
413
* @param {object} callbackContext - The context in which the callback will be called.
@@ -409,6 +419,41 @@ Phaser.Input.prototype = {
409
419
410
420
},
411
421
422
+
/**
423
+
* Adds a callback that is fired every time the activePointer receives a DOM move event such as a mousemove or touchmove.
424
+
* It will be called every time the activePointer moves, which in a multi-touch game can be a lot of times, so this is best
425
+
* to only use if you've limited input to a single pointer (i.e. mouse or touch).
426
+
* The callback is added to the Phaser.Input.moveCallbacks array and should be removed with Phaser.Input.deleteMoveCallback.
427
+
*
428
+
* @method Phaser.Input#addMoveCallback
429
+
* @param {function} callback - The callback that will be called each time the activePointer receives a DOM move event.
430
+
* @param {object} callbackContext - The context in which the callback will be called.
431
+
* @return {number} The index of the callback entry. Use this index when calling Input.deleteMoveCallback.
0 commit comments