mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Gamepad._created
is a new private internal property that keeps track of when the instance was created. This is compared to the navigator timestamp in the update loop to avoid event spamming. Fix #4890.
This commit is contained in:
parent
5ecdc3b4a2
commit
2acfbfbe71
1 changed files with 15 additions and 0 deletions
|
@ -313,6 +313,16 @@ var Gamepad = new Class({
|
|||
* @since 3.10.0
|
||||
*/
|
||||
this.rightStick = new Vector2();
|
||||
|
||||
/**
|
||||
* When was this Gamepad created? Used to avoid duplicate event spamming in the update loop.
|
||||
*
|
||||
* @name Phaser.Input.Gamepad.Gamepad#_created
|
||||
* @type {number}
|
||||
* @private
|
||||
* @since 3.50.0
|
||||
*/
|
||||
this._created = performance.now();
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -420,6 +430,11 @@ var Gamepad = new Class({
|
|||
*/
|
||||
update: function (pad)
|
||||
{
|
||||
if (pad.timestamp < this._created)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var i;
|
||||
|
||||
// Sync the button values
|
||||
|
|
Loading…
Reference in a new issue