+ 6

Mousedown event fires on mobile?

So, while making a game, I stumbled upon a bug where a single click would register twice in the game. Was wondering what the issue could be, and after a while I realized that the handelrs for both mousedwon and touchstart where both being fired. This happened only on mobile Was certain it was an issue with my phone, but then I checked it out with chrome dev tools on my laptop and when inspecting as a mobile device, the same thing happened Yeah, this Is a simple issue to take care of I guess But, does this happen though?

28th Mar 2021, 2:34 AM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
7 Antworten
+ 4
Russ Hmm, so it seems to be an Android only thing Kode Krasher Here we go again...­čśÄ­čĹŹ
28th Mar 2021, 9:55 PM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
+ 4
Russ Yup, seems like an "only Android" issue, smh Your feedback is very much appreciated! ^_^
28th Mar 2021, 10:03 PM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
+ 3
Mirielle[ Exams ] I believed the same as well, but from the way to code in the game is, It is certain that the touch and mouse events fire on after another... Are you on android? If so, could you check the code above and check if they both fire for you as well?
28th Mar 2021, 9:57 PM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
+ 3
Kode Krasher Another useful template from Space Ace himself! Touchscreen laptops will be at a loss though as they will losse the consistent firing of mousemove, but that's is a little price to pay!
28th Mar 2021, 10:14 PM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
+ 2
Here is an example code so you can try it out for yourself... https://code.sololearn.com/WmVwAhHHw6PL/?ref=app
28th Mar 2021, 2:36 AM
Vachila64ÔśĽ
Vachila64ÔśĽ - avatar
+ 2
Just to add to your troubles, onmousedown doesn't trigger anything for me in your example code. Only when I change it to ontouchstart do I get the alert box. This is on iPhone.
28th Mar 2021, 8:57 AM
Russ
Russ - avatar
+ 2
Vachila64ÔśĽ Now I just get the "touch event" alert.
28th Mar 2021, 9:58 PM
Russ
Russ - avatar