onPointerObservable ignoring tablet pen input

Hi, everyone,
I’m struggling with this “Max number of touches exceeded. Ignoring touches in excess of 2” warning.

I’ll describe what I think the problem is:
When the pointer leaves and re-enters the canvas element, it retains the same pointerId. However, if the pointer leaves and re-enters the page or if the pen temporarily leaves the tablet’s hover range, it is assigned a new pointerId.

In BJS’s webDeviceInputSystem, these IDs are stored in a limited-size _activeTouchIds array. The issue is that this array is not cleared of the previous pointerId used by the pen when a new one is assigned. It seems that this clearing only occurs within the element “blur” and “pointercancel” events.

For context, I’m using a Wacom Intuos tablet with Windows Ink enabled (If Windows Ink is disabled, the browser just treats the pen like a mouse)


cc @amoebachant

Looking into it!

2 Likes

Hi @fuyutami ,
Thanks so much for this bug report! Based on what you shared, I was able to reproduce the problem, spot the bug, and the fix is now merged: When pointerleave is raised during a pen operation, cancel it (#16156) · BabylonJS/Babylon.js@7aedc45 · GitHub

Let me know if that fixes it for you!

2 Likes

It is fine now. Thank you!

1 Like