Skip to content

ElementTouchEvent uses wrong type for its touches #7927

@ThatStevenGuy

Description

@ThatStevenGuy

Hey everyone,

When I try to access the id-field on touches contained within an ElementTouchEvent, I always receive undefined. Upon further inspection, it turns out touches contained within ElementTouchEvent are of the DOM Touch-type rather than ElementTouchEvent.Touch as declared by the most recent PlayCanvas type definitions (playcanvas@2.10.6 from NPM).

Here's a screenshot of VSCode showing the type of the touch-field on an ElementTouchEvent:

Image

Here's a confirmation through some debugging that the touch event I receive from my ElementComponent is in fact of type ElementTouchEvent, and that touches contained within are of the DOM Touch-type:

Image

It turns out that element-input.js in the engine just passes the native Touches it receives straight into a new ElementTouchEvent rather than converting them:

Image

Just for clarity, the constructor of ElementTouchEvent doesn't convert the touches either.

I guess either the type definitions pulled from NPM are incorrect, or the touches should have been converted to the appropriate type so that the id-field on touches can be used as expected.

Can someone please address this?
Thanks a bunch! 💪

Metadata

Metadata

Assignees

Labels

area: inputInput related issuebugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions