Jump to content

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.

Link to comment
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 :(

Link to comment
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.

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.

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.


  • Recently Browsing   0 members

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