OnPointerOverTrigger / OnPointerOutTrigger sourceEvent is undefined

Hi!

Could we add sourceEvent to ActionManager.OnPointerOverTrigger and OnPointerOutTrigger?

I’m need to check if the sourceEvent.pointerType === ‘touch’ to do some logic.

Since we are able to get the sourceEvent for onPick I don’t see why we shouldn’t be able to get it for Over and Out?

Those two events work different in babylon.js and your browser. We have to emulate them, since the meshes are not HTML elements. Pointer move, up and down are still registered correctly on the canvas (and passed to the scene), but pointer over and out are only simulated by us.

I assume you can register to the pointer-move event and use it to check if the user is using touch and a mouse, parallel to those events?

I solved it by listening for the pointerenter event on the canvas and then storing the pointerType value.
and then in OnPointerOverTrigger checking against that value.

since the pointerenter event seems to always be run before the onPointerOverTrigger it seems to work well.

2 Likes