Jump to content

Mouse events dispatched on mobile device?


bosko
 Share

Recommended Posts

Hi all,

 

I'm new to pixi. I decided to switch game engine, I used in my game, with pixi. I must say it has AMAZING performance on mobile devices (ipad, nexus 7). All is great exept one thing I found: if I set mouse and touch events like this:

sprite.mousedown = sprite.touchstart = func;

Then, sometimes, on mobile devices, a single touch dispatch 2 touch events. After debuging, I realized that it was not 2 touch events, but one touch and one mouse event! How can mouse event be dispatched on mobile device? So, when I set events like this:

if (mobile) {  sprite.touchstart = func;} else {  sprite.mousedown = func;}

Then all is ok. But I think that it should work with first example too. It's better to write 1 line of code then 4. This way I'm forced to write a function which will set events in order to not repeat if-else over and over again.

Thanks.

 

Bosko

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...