BabylonJS / Babylon.js

Babylon.js is a powerful, beautiful, simple, and open game and rendering engine packed into a friendly JavaScript framework.
http://www.babylonjs.com
Apache License 2.0
23.1k stars 3.41k forks source link

_pointerDownEvent now reuses the _activeTouchIds slot if _pointerMove… #15115

Closed AmoebaChant closed 4 months ago

AmoebaChant commented 4 months ago

On some devices, pen inputs can start with pointerMove instead of pointerDown. In that case, we were adding the pointerId to the _activeTouchIds in pointerMove, and instead of reusing that slot when pointerDown came along later, we were grabbing a second slot for the pointerId. Then later, when pointerUp came along, we only cleaned up one of them.

With this change, pointerDown will reuse the existing slot if found - grabbing a new slot only if this pointerId doesn't already have one, so we should no longer get one pointerId in two slots.

Reported in the forum here: https://forum.babylonjs.com/t/hitting-max-number-of-touches-exceeded-ignoring-touches-in-excess-of-5-when-using-a-pen-on-a-tablet-samsung-s-pen/50593

bjsplat commented 4 months ago

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). To prevent this PR from going to the changelog marked it with the "skip changelog" label.

bjsplat commented 4 months ago

Snapshot stored with reference name: refs/pull/15115/merge

Test environment: https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15115/merge/index.html

To test a playground add it to the URL, for example:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15115/merge/index.html#WGZLGJ#4600

Links to test babylon tools with this snapshot:

https://playground.babylonjs.com/?snapshot=refs/pull/15115/merge https://sandbox.babylonjs.com/?snapshot=refs/pull/15115/merge https://gui.babylonjs.com/?snapshot=refs/pull/15115/merge https://nme.babylonjs.com/?snapshot=refs/pull/15115/merge

To test the snapshot in the playground with a playground ID add it after the snapshot query string:

https://playground.babylonjs.com/?snapshot=refs/pull/15115/merge#BCU1XR#0

sebavan commented 4 months ago

Is there a way to simulate it in the input unit tests ?

bjsplat commented 4 months ago

WebGL2 visualization test reporter:

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15115/merge/testResults/webgl2playwright/index.html

bjsplat commented 4 months ago

Visualization tests for WebGPU (Experimental) Important - these might fail sporadically. This is an optional test.

https://babylonsnapshots.z22.web.core.windows.net/refs/pull/15115/merge/testResults/webgpuplaywright/index.html