Bug with BABYLON.Scene.ExclusiveDoubleClickMode

Hi everybody,

I don’t know exactly when the bug began but i mean 2 or 3 weeks ago.

Here’s my PG : https://playground.babylonjs.com/#VIPDZM#4

If I work with BABYLON.Scene.ExclusiveDoubleClickMode = true, i cannot get anymore the simple click on a mesh (EVENT=32) and i’m pretty sure that it worked in the past.

BUT

If i work with BABYLON.Scene.ExclusiveDoubleClickMode = false, i get the click (EVENT=32) before the double click (EVENT=64) and i don’t want that because the triggered events are different on the click and the double click.

Could you help me ?

Thanks in advance,

Boris

cc @PolygonalSun

Hey @bvaisman,
I just want to confirm. Are you saying that when you have ExclusiveDoubleClickMode = true that you don’t see a single click event but when it’s false, you see the single click event occur before the double click event after a double click is initiated?

The reason I wanted to confirm this is because when I try that PG, I see the following interactions (ignoring any move events):
ExclusiveDoubleClick = false

  1. Click down on mouse
    a. POINTERDOWN observable fired
  2. Release mouse
    a. POINTERUP observable fired
    b. POINTERTAP observable fired
  3. Click again
    a. POINTERDOWN observable fired
  4. Release again
    a. POINTERUP observable fired
    b. POINTERDOUBLETAP observable fired

ExclusiveDoubleClick = true

  1. Click down on mouse
    a. POINTERDOWN observable fired
  2. Release mouse
    a. POINTERUP observable fired
  3. Click again
    a. POINTERDOWN observable fired
  4. Release again
    a. POINTERUP observable fired
    b. POINTERDOUBLETAP observable fired

When ExclusiveDoubleClick = true, it should ignore any single click events (but still fire up and double tap). When false, it’s supposed to either fire a tap or a double tap but never both off of a single click. If what I’ve described above isn’t what you’re seeing, could you tell me what browser you’re seeing this behavior on?

Hi,

Thanks for your interest.

I work with Chrome Version 110.0.5481.178 (Build officiel) (64 bits). It is the last one.

On my playground,

with ExclusiveDoubleClick = true

When I click :

I obtain pointerinfo.type = 1 and pointerinfo.type = 2 (PointerDown and PointerUp)

I never obtain the POINTER TAP event (32)

When I double click :

I obtain pointerinfo.type = 1 and pointerinfo.type = 2 (PointerDown and PointerUp) twice then pointerttypeinfo.type = 64 (DBL CLICK EVENT)

with ExclusiveDoubleClick = false

When I click :

I obtain 4 events :
pointerinfo.type = 1, pointerinfo.type = 16, pointerinfo.type = 2 AND finally pointerinfo.type = 32

When I double click :

I obtain 7 events :
pointerinfo.type = 1, pointerinfo.type = 16, pointerinfo.type = 2, pointerinfo.type = 32, pointerinfo.type = 1, pointerinfo.type = 2 and FINALLY pointerinfo.type = 64

And before, i’m sure it did not work like that because i used ExclusiveDoubleClick = true to avoid the click event when i double clicked. Now i never obtain the click event even if I click once.

And my purpose is to avoid the click event when i double click.

I already posted a question a few weeks ago and you told me to proceed like that (Bug on PointerEventTypes?). It worked well until two or three weeks ago.

Hope I’m clear. :wink:

Thanks for your answer.

Boris

@bvaisman thanks a lot for the repro and explanation !!! It will be a huge help for @PolygonalSun

Thanks for clearing that up! Lemme take a closer look.

I’ve identified the issue and created a PR for the fix: InputManager: Fix scenario where click can occur when ExclusiveDoubleClickMode = true by PolygonalSun · Pull Request #13577 · BabylonJS/Babylon.js (github.com)

1 Like

PR is merged

I’m sorry but i’ve tried again My PG with the new version 5.49.0 and it does not work.

Here’s my new PG with extra console.logs

and my tests :

image

when ExclusiveDoubleClick = false, works with POINTERTAP event but impossible to catch the POINTERDOUBLETAP event without the POINTERTAP event

image

when ExclusiveDoubleClick = true, impossible to get the POINTERTAP event.

Boris

Update :

exactly the same behavior with Opera (last version)

@PolygonalSun will have a look ASAP

Sorry about the delay on this. So when I started digging into the code for that flag, it looks like what was happening was that the InputManager was creating an UP event but firing the TAP event without properly resetting the pointer capture flag. Because of this, the input was getting canceled prematurely as an UP event was already process (ie. we’ve already release the mouse button so we can’t logically release it again. My tentative fix is to try and separate the UP and TAP functionality so that the up releases on time but just the TAP code executes on the determination that the input isn’t a DOUBLETAP. Since we use a timeout to handle the delay handling, I’ve been working on making sure that the timeout is properly handled and that the actual timing of event execution is working as it’s expected to. The fix has been a bit more complex than expected. I’m still working on this and will update when I’ve made more progress.

2 Likes

@PolygonalSun

I don’t know how to help you. I’ve seen that you wrote a PR to change the logic for ExclusiveDoubleClick mode but i’m ABSOLUTELY sure it worked perfectly well before. The problem is that i’m not able to tell you the exact version in which it began to fail. What i know is that you gave me the solution of my question on 09/22/2022. So i assume that there were no issue with this version of Babylon. And it worked well until… the first or second week of february i presume

May be it is just a side effect of another part of the code.

Thanks anyway for your speed. Even if we have to wait for a couple of days to solve a bug, with some other softwares, we have to be a little bit more patient and wait for a couple of… years… decades… :grin:

IIRC, there was a previous issue related to the tracking of pointer capture and fixing that may have broken this. In any case, I’ve revised the logic and put it in my PR to fix this: InputManager: Modified Logic for ExclusiveDoubleClickMode For Click/DoubleClick Mutual Exclusivity by PolygonalSun · Pull Request #13582 · BabylonJS/Babylon.js (github.com)

2 Likes

PR is merged

1 Like

And it works !!!

1 Like