phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
36.94k stars 7.08k forks source link

button.events.onInputOver doesn't fire for a short while after clicking on canvas. #2062

Closed meierw closed 8 years ago

meierw commented 9 years ago

After you click anywhere on the game canvas for short while you can move the mouse over a button and onInputOver won't fire and the button won't change to the 'over' frame.

This is even the case with very simple code, with nothing special coded into the buttons. For example I used this demo http://phaser.io/examples/v2/buttons/action-on-click and made a short video with clicking audio cues to demonstrate the problem. https://youtu.be/F_L6-UkeX0A

pnstickne commented 9 years ago

Verified Chrome and Firefox in Phase 2.4.3

meierw commented 9 years ago

Judging by the comment next to j27cai's fix

//  If the Pointer was only just released then we don't fire an over event

This functionality was implemented intentionally? If so, why? Feel free to correct me, if I'm missing something. I'm pretty new to github, and how all these commits, fixes and other features work is a bit confusing to me atm.

pnstickne commented 9 years ago

AFAIK there was a fix for/relating to this a year ago or so .. but the details as to what the ultimate issue at the time was escape me.

I do believe that investigating why the just-pressed check is in there needs to be done as a cursory check. It is a 'back-off guard' - I believe it's related to "maintaining the 'pressed visual state'" for a duration.

pnstickne commented 9 years ago

I haven't been able to find out why this would be needed and haven't been able to simulate a use-case.

It was added in a "JSDoc fixes" (being not too helpful a message), https://github.com/photonstorm/phaser/commit/96fd0ade - ironically enough it is 'about' the time I was doing some input updates, but I don't remember exactly what I was working on :}

meierw commented 9 years ago

Thanks for the feedback.

So any ideas what's the next course of action? ATM this issue makes the UI of my game feel buggy. I have a system that shows what a menu button does when the player moves the mouse over it. Also the player doesn't have to move the mouse between buttons very quickly, like I demonstrated in the video. Just casual clicks and movement still fall in this .justReleased range.

The game is still in development, but would be nice to know if I have to consider some other UI library or if this issue will be addressed some time in the future.

pnstickne commented 9 years ago

If it were me, I'd monkey-patch the method to remove the check and move on with the game development.

Most every framework/library has quirks that need a little love. Thankfully this scenario - aided by the fact it's JavaScript and object properties are used - is easy to work around until when (if) a more universal change is committed in which case the patch can be removed.

At this point I'm for disabling the check entirely .. but still really need to know under what use-cases(s) it was added. There is no specific button fix mentioned in the 2.3.1 release either.

meierw commented 9 years ago

Dunno who this VictorBjelkholm character is, but thanks for the advice. Never have tried tinkering with other peoples code, but I guess it's never too late to start.

Will keep the issue open for now since it's still present in phaser and we might get some more info down the line.

pnstickne commented 9 years ago

@VincentMeier Auto-complete fail :} But indeed; the issue is still not resolved.

photonstorm commented 8 years ago

With this fix now merged are we good to close this issue off?

meierw commented 8 years ago

I guess so. Thanks for all the help.