Canvas doesn't respond after some iOS gestures

Monkey Forums/Monkey Bug Reports/Canvas doesn't respond after some iOS gestures

secondgear(Posted 2013) [#1]
Full-screen HTML5 canvas stops responding to touch events after I open and close Control Center on an iOS 7 device. The game keeps running (not paused). Here is the test:

1. Run warpy/monkeypuzzle from bananas compiled in 76d with RESIZEABLE_CANVAS=true
2. Move the monkey around.
3. Swipe from the bottom to open control center.
4. Close control center.
5. Try moving the monkey.

Same thing happens if you swipe left to right, which is Safari's gesture for going back in browser history. When you swipe right to left to come back to the monkey page, the canvas doesn't respond to touch anymore.

If I set RESIZEABLE_CANVAS=false, there seems to be no problem with touch events. Spoke too soon: if "swipe left to right" gesture lands on the canvas, then after I come back to the page, the canvas doesn't respond to touch.


secondgear(Posted 2013) [#2]
Ok, now I know why it happens, but I'm not sure what to do about it.

Normal one-finger touch events fire like this:
ontouchstart-(N x ontouchmove)-ontouchend

However, in case of from-the-edge swipe to activate control center, Monkey canvas receives only
ontouchstart-(N x ontouchmove)

Without ontouchend, mojo interprets any subsequent ontouchstart as a second finger touch, which my game and the demo above do not expect and do not process.

Any ideas?


marksibly(Posted 2013) [#3]
I've messed around a bit with this and it is indeed tricky.

The app doesn't even seem to get an onblur event when control center activates, so I can't just force-flush the touch states.

There does seem to be a lot of complaints around about ios 7 and 'fullscreen' html5 apps - esp. rude of Apple to 'steal' swipe left/right gestures!

But for now, I'm a bit stumped by this one sorry.


secondgear(Posted 2013) [#4]
Thank you for taking time to look into it. I forced mojo to use only the first touch "channel", which solves my problem at the expense of losing multi-touch functionality.

I am not sure it's worth your time to look for a graceful solution for this problem. Probably not too many people use Monkey to make iOS web apps. This one was my first, and it was made for a client.