Skip to content

Commit

Permalink
Add Phaser.Utils.Debug#inputHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
samme committed May 1, 2020
1 parent 1627731 commit 78dc127
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/utils/Debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,50 @@ Phaser.Utils.Debug.prototype = {

},

/**
* Prints information about an input handler, e.g. `this.input.mouse`.
*
* @method Phaser.Utils.Debug#inputHandler
* @param {Phaser.Keyboard|Phaser.Mouse|Phaser.MouseWheel|Phaser.MSPointer|Phaser.PointerLock} handler
* @param {string} name
* @param {number} x
* @param {number} y
* @param {string} color
*/
inputHandler: function (handler, name, x, y, color)
{
this.start(x, y, color);

this.line(name || '?');
this.line('active: ' + handler.active);

if (!handler.active)
{
this.stop();

return;
}

this.line('enabled: ' + handler.enabled);

if ('capture' in handler)
{
this.line('capture: ' + handler.capture);
}

if ('preventDefault' in handler)
{
this.line('preventDefault: ' + handler.preventDefault);
}

if ('event' in handler)
{
this.line('event: ' + (handler.event ? handler.event.type : handler.event));
}

this.stop();
},

_inputHandler: function (handler, name)
{
return this._inputHandlerStatusIcon(handler) + ' ' + name + ' ' + this._inputHandlerCaptureIcon(handler);
Expand Down

0 comments on commit 78dc127

Please sign in to comment.