cykod / Quintus

HTML5 Game Engine
http://html5quintus.com
GNU General Public License v2.0
1.41k stars 401 forks source link

Touch event triggered twice on Android #48

Closed fariazz closed 10 years ago

fariazz commented 11 years ago

Touch event on mobile is being triggered twice on Android. To test click on any of the numbers (tested on Android 4.1 browser), it will show the number twice:

http://static.pablofarias.com/racinggame2/

May have to do with the way I'm using the viewport. What I want to achieve is to fit to width of the device without showing more of the game world. Using maximize: "touch" shows a blank screen on my phone, using maximize: true, messes up the alignment of the GUI and the background (the link above only has the GUI. I'll be releasing the full game once finished in a blog post).

(basically I just want to re-scale the entire game to fit the screen, the way it happens in LimeJS for instance, without showing extra parts of the level)

fariazz commented 11 years ago

this seems to be an issue that was present in an early version of Crafty as well: http://craftyjs.tumblr.com/post/4601812926/0-4-2-released

fariazz commented 11 years ago

Tested in Chrome and FF on a Android 4.2 tablet and it works fine, although these browsers don't seem to support the viewport tag.

I think this is related to the viewport tag in some way.

yckart commented 11 years ago

Mhh, it seems that there's a mistake in your code, I get this error message:

Uncaught TypeError: Cannot read property 'lists' of undefined 
fariazz commented 11 years ago

hi @yckart try the finished version of the game, it happens too and there are no errors: http://static.pablofarias.com/racinggamefinished/

fariazz commented 11 years ago

In my Android 4.2.2 tablet the bug occurs using the native Android browser. Using Chrome and FF is not observed. So far seen in the native browser in Android 2.3, 4.1 and 4.2.2.

fariazz commented 10 years ago

I get the impression this was solved here: https://github.com/thatpixguy/Quintus/commit/987fb8b9d8f864705d3bc0b36d5a282b3ef568bf but somehow never nade it to the main repo

cykod commented 10 years ago

Problem with that solution was hasTouch is true for a whole bunch of desktop browsers - which then don't trigger the mouse events.

fariazz commented 10 years ago

You are right! didn't think of those Windows 8 "yoga" tablets :)

fariazz commented 10 years ago

It seems the issue is on the old Android browser only, at least it's not present on Android Chrome or FF and people who published to Android using Cordova haven't reported this issue.

New Android devices come with Chrome as the default browser so this issue is no longer present on those.

I don't like the idea to make a tweak for a particular browser that's not even used in newer devices. If we did something like this (https://github.com/cykod/Quintus/issues/39#issuecomment-47042042), developers who want to support this browser could easily turn mouse events off when on it.