Hello,
I reporting a possible bug. I consider adding it to GitHub, but first I want to ask you opinion. Thank you for consideration.
I use Phaser CE 2.12.0 + Cardova Android. Testing on Android 8 (real device).
The game sometimes stops receiving any touch events. Nothing is touchable, although all the rest of the app (animation, etc) continue working. The problem resolved after collapse/restore the app.
After digging into Phaser source code, I find out that initial events _onMSPointerDown and _onMSPointerUp continue dispatching fine, but it never get propagated to my code. I was able to figure out the reason.
It seems that pointer up
event sometimes get missed. If this happens, the game stops receiving any subsequent touch events.
The sequence is the following:
- The game receiving _onMSPointerDown event
- Pointer locks in
active
state. The event.identifier stored in pointer1.identifier. - The up event with the same identifier lost (probably due of processor load)
- Any further pointer down events ignored because pointer is in active state (it’s awaiting for up event)
- Any further pointer up events also ignored because new event identifier doesn’t match the stored one.
- All touch events locked now.
Source for #4:
Line 39558: if (!this.pointer1.active) <-- this now never true (the same for pointer2)
Source for #5:
Line 39634: if (this.pointer1.active && this.pointer1.identifier === event.identifier) <-- identifiers doesn’t match, the touch never stops (the same for pointer2)
The problem is reproducible, but random. Happens more often when device is slower or debugger attached. I want to emphasis that problem happens on real device testing in release version without any debugger attached. The debugger just make the problem much worse and easier to reproduce.
** UPDATE **
After some digging more, I find out that instead of _onMSPointerUp I’m getting _onMSPointerOut. I found the following solution (a hack), which seems to works for now, but more testing is coming up:
game.input.mouse.mouseOutCallback = function (event) {
console.log('Mouse out callback: ’ + event);
game.input.pointer1.stop(event);
game.input.pointer2.stop(event);
};
Thank you,
Mike