New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[2.4] Button callback doesn't trigger on click #1932
Comments
Can you test this against 2.4.1 please, as they seem to be working fine for me, but there were definitely issues in some browsers with click events on 2.4.0. |
In 2.4.1 aren't working both. Browser: Firefox 39.0 (64bit, I'm pretty sure); EDIT: almost forgot: |
It's not working for me too. |
Must be Linux specific. Works fine in Firefox 38, 39 and 41 on Windows and OS X. In which case I need you to do this please: edit Pointer.start and at the top log out the event, build it and post the results up here. I don't have Linux running anywhere, but I'm surprised it doesn't include the buttons property. Actually you could probably get it by just logging out |
mousedown { target: <canvas>, buttons: 1, clientX: 409, clientY: 257, layerX: 409, layerY: 257 } The event is catch properly. After a bit of debugging seems like the Phaser.Pointer.targetObject is set correctly and the touchedHandler executed. And indeed after the window regain focus the callback is correctly executed. After disabling all breakpoints and try again, the event is logged properly but the callback isn't executed again |
Ok so that's weird - it's nothing to do with the mouse event itself then? and I can see you've got a buttons property too - so it much be the touchedHandler check itself that is failing? (even though I've barely touched that for ages) |
Ok, I debugged deeply and things became more strange. First, the _toucherHandler is the same for 2.3 and for 2.4.1. THe only difference is in a test (but it's equivalent semantically) and in the comment. Exactly in that test if (!this._pointerData[pointer.id].isDown && this._pointerData[pointer.id].isOver) The log showed This is because in the _releasedHandler, in the test if (this._pointerData[pointer.id].isDown && pointer.isUp) this._pointerData[pointer.id].isDown = true; Still the first click should work fine, but the callback isn't executed |
Update: the code var btn = this.game.add.sprite (200, 200, 'playButton');
btn.inputEnabled = true;
console.log(btn);
btn.events.onInputDown.add(function() {
console.log('________________callback executed________________________');
//doStuffs
}, this); works for the first click and skip the following, as espected |
Button callbacks are working for me with |
Could you all please try the latest build in the dev branch. I've uploaded build files as well for you. But I am pretty sure I've found the cause of it and in my tests in native Cordova apps and on Windows and OSX it's working correctly once again. |
v2.4.2 "Altara" - Built: Mon Jul 27 2015 13:35:06 Works for Linux Mint and Chrome. Same problem as before for firefox (39.0, up to date). First click detected but callback not executed, onReleaseHandler doesn't set the pointerData.isDown to false and the following clicks are ignored bu the touchedHandler |
Firefox on Linux I assume? because it works fine with FF on Windows and OSX. |
Could you please try this for me? In |
Yes, I've tested only Linux 'cause the problem seems to appear only there. But I can see your point. As soon as I have a Win machine at hand (I hope before this night) I will test my code on it, just to be sure that it's a Phaser problem and not something crappy about my code |
Result from a single click, what is print and from who (PS: even if the event Mouse.move is present, the mouse wasn't moved in the test) console.trace(): "event.type" "mousedown" console.trace(): "event.type" "mousedown" console.trace(): "event.type" "mouseup" |
Interesting - so it does actually have the buttons property, but the value is always 1. |
Yep. Instead of an array of buttons, it's set to 1 for the left click, 2 for the right click, etc. |
I've been having the same problems. While trying to debug the problem I discovered something that may help narrow down the problem. In Firefox, I brought up the Developer Debugger, and on the right side under Events checked off mousedown and mouseup. Then, I went to click on a Button object, and when the debugger stops the script I click the button a few times, hold down Ctrl, step over one line of code, and press play. After that, the callback gets called. |
I think the only way to debug this properly is for me to install a VM or similar. Any recommendations on distros? |
Ubuntu 14.04 or 15.04, those are the most common |
I have Ubuntu 14 running at the moment and can replicate it - the buttons value is populated, but utterly incorrect. Adding in a work-around now. |
Ok this should be good now - please try the new dev branch build |
Works fine on Firefox 39.0, Linux Mint 17 64bit |
Works on Fedora 22 as well :) |
Awesome :) Will do some more tests on touch devices, but it's looking good for 2.4.2 this week then. |
Touch controls work with I'm excited to see these changes into release! |
Awesome. I'll push out 2.4.2 today then. |
In 2.4.0, the button callback doesn't trigger on mouse click. With phone touch works fine (and the same code works under 2.3). Maybe related to the changes to Input.Mouse?
Code (trivial, but you never knows...):
The text was updated successfully, but these errors were encountered: