Skip to content

Commit 818c642

Browse files
committed
SinglePad.onDownCallback has been moved to the end of the method, so that DeviceButton.start is now called before the callback fires, meaning if you check the status of the button in the onDownCallback it will now be fully activated (thanks @suicidepills phaserjs#2159)
1 parent 829b1e7 commit 818c642

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
308308
* Camera.checkBounds now takes the scale of the Camera into account (thanks @ForGorNorPor #2263)
309309
* InputHandler.consumePointerEvent has been removed, as it was never used internally anyway, so was misleading (thanks @GregoryAveryWeir #2227)
310310
* Events.onDragUpdate has a new 6th property `fromStart` which is a boolean. You can determine if the event was the result of the start of a drag movement or not by polling it (#2155)
311+
* SinglePad.onDownCallback has been moved to the end of the method, so that DeviceButton.start is now called before the callback fires, meaning if you check the status of the button in the onDownCallback it will now be fully activated (thanks @suicidepills #2159)
311312

312313
### Bug Fixes
313314

src/input/SinglePad.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,11 @@ Phaser.SinglePad.prototype = {
360360
*/
361361
processButtonDown: function (buttonCode, value) {
362362

363+
if (this._buttons[buttonCode])
364+
{
365+
this._buttons[buttonCode].start(null, value);
366+
}
367+
363368
if (this._padParent.onDownCallback)
364369
{
365370
this._padParent.onDownCallback.call(this._padParent.callbackContext, buttonCode, value, this.index);
@@ -370,11 +375,6 @@ Phaser.SinglePad.prototype = {
370375
this.onDownCallback.call(this.callbackContext, buttonCode, value);
371376
}
372377

373-
if (this._buttons[buttonCode])
374-
{
375-
this._buttons[buttonCode].start(null, value);
376-
}
377-
378378
},
379379

380380
/**

0 commit comments

Comments
 (0)