PointerUp not triggered on some android devices

Recommended Posts


noticed issue with pointer up event on onPointerObservable for some android devices, looks like sometimes pointer up is not triggered just pointerDown and pointerCancel.

So `totalPointersPressed` is counting up and is not lowered. Not sure if we can fix that on babylonjs side, as my fix  was to add cancel listener to window and call onPointerUp there, it works but could lead to different issues, as click is triggered without releasing finger from the screen for example. I have seen it very rarely on newer devices as well but on this android it repeats every second click.

Device: Android 5.1.1, Galaxy Note 4, Stock browser (Internet)

Maybe someone have some ideas what could be done there, without breaking it for rest of the devices.

Share this post

Link to post
Share on other sites

Can you share how you are handling pointer events?  ie: using <canvas... touch-action="none"/> and jquery PEP

If it's really a browser quirk, if we can assume that two pointer down events shouldn't occur, without a pointerUp occuring inbetween then we can maybe write a hacky fix.  Check out this PR I did ages ago on PointerUp for GUI button - this was occurring if, for example, you moused off the canvas (pointerUp off canvas) and then did another pointer-down, so not android specific the pointer up was being missed by BabylonJS.  That kind of solution would work for you here as well, in some cases.  Anyway, may give you some ideas or attach to document.body for Android?
Depends on what you are trying to accomplish.  I think if you end up triggering/simulating a pointerUp event just before 2nd down (w/o an up) then you need to choose if that happens where the last down was or where the new down was - as you will statefully need to remember.  That's really the only idea that I have... like your own polyfill :(

Share this post

Link to post
Share on other sites

@brianzinn Hey, yes I use ` <canvas... touch-action="none"/> and jquery PEP` for pointer events, but pointer up is registered in window in babylonjs engine not sure if that can impact PEP.

Then use observable from engine to listen to pointer events.

Technically you can have 2 down events as you can press 2 fingers on the device, but each down event should trigger up. But really can nit find why android is canceling these events.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.