Skip to content

Commit 6c9e43a

Browse files
committed
DeviceButton was setting a duration property on itself, which went against the read only getter of duration (thanks @winstonwolff)
1 parent 90a500e commit 6c9e43a

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
277277
* Time.update has been streamlined and the `updateSetTimeout` and `updateRAF` methods merged and duplicate code removed.
278278
* Time.desiredFpsMult is a pre-calculated multiplier used in Game.update.
279279
* Time.refresh updates the `Time.time` and `Time.elapsedMS` values and is called automatically by Game.update.
280+
* DeviceButton was setting a `duration` property on itself, which went against the read only getter of duration (thanks @winstonwolff)
280281

281282
### Bug Fixes
282283

src/input/DeviceButton.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,6 @@ Phaser.DeviceButton = function (parent, buttonCode) {
6464
*/
6565
this.timeDown = 0;
6666

67-
/**
68-
* If the button is down this value holds the duration of that button press and is constantly updated.
69-
* If the button is up it holds the duration of the previous down session.
70-
* The value is stored in milliseconds.
71-
* @property {number} duration
72-
* @default
73-
*/
74-
this.duration = 0;
75-
7667
/**
7768
* @property {number} timeUp - The timestamp when the button was last released.
7869
* @default
@@ -169,7 +160,6 @@ Phaser.DeviceButton.prototype = {
169160
this.isDown = true;
170161
this.isUp = false;
171162
this.timeDown = this.game.time.time;
172-
this.duration = 0;
173163
this.repeats = 0;
174164

175165
this.event = event;
@@ -278,7 +268,6 @@ Phaser.DeviceButton.prototype = {
278268
this.isUp = true;
279269

280270
this.timeDown = this.game.time.time;
281-
this.duration = 0;
282271
this.repeats = 0;
283272

284273
this.altKey = false;
@@ -309,7 +298,7 @@ Phaser.DeviceButton.prototype = {
309298
Phaser.DeviceButton.prototype.constructor = Phaser.DeviceButton;
310299

311300
/**
312-
* How long the button has been held down.
301+
* How long the button has been held down for in milliseconds.
313302
* If not currently down it returns -1.
314303
*
315304
* @name Phaser.DeviceButton#duration

0 commit comments

Comments
 (0)