Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by SlotGamer

I have some simple buttons where I detect mousedown and mouseup and everything has always worked well on chrome/IE9. But on iPad, every so often I don't receive a mouse up event at all. Anyone know why? Or have a workaround?

I don't need touch events as far as I know and I disabled touch and gesture events.

1 decade ago by Joncom

The iPad and similar devices work a little differently because you are not using mouseup and mousdown events. Instead you are using touchstart and touchend events. Source

Are you certain that "every so often" you don't receive mouseup events? I would suspect that if you're not receiving some, you're not receiving any at all.

1 decade ago by SlotGamer

Thanks Joncom. I found the problem. Occasionally, I was getting a mouse up event in the same frame as the mouse down and my code was not properly checking for this. So I changed this:

if ( ig.input.pressed( 'MouseEvent' ) ) {
// caught mouse down
}
else if ( ig.input.released( 'MouseEvent' ) ) {
// caught mouse up
}

To:

if ( ig.input.pressed( 'MouseEvent' ) ) {
// caught mouse down
}

if ( ig.input.released( 'MouseEvent' ) ) {
// caught mouse up
}

and everything now works correctly.
Page 1 of 1
« first « previous next › last »