Skip to content

Touch events report coordinates relative to the phone screen itself in browser builds #9071

@dearlordylord

Description

@dearlordylord

Bevy version

0.10.1

What you did

Compiled into wasm / attached to a specific canvas (but I think no explicit canvas will do as well)

What went wrong

  • what were you expecting?

touch events are relative to the canvas

  • what actually happened?

touch events are reported relative to the screen (not even to the browser window!)

Other information that can be used to further reproduce or isolate the problem.

  • screencast
telegram-cloud-document-2-5282792564146056949.mp4
  • workarounds that you used

explicitly send canvas.getBoundingClientRect() and use this data in your system to calculate the actual touch coords

  • links to related bugs, PRs or discussions

probably #7528

  • reproduction case deployed

https://touchies.apps.loskutoff.com/

  • reproduction source code

https://github.com/Firfi/touchies

  • notes

please note that the touch is being reported not even related to the browser window (which I could've worked around giving the app its canvas coordinates) bit the phone screen itself, as shown in the attached screencast

for mouse event comparison, the example deployed also has mouse event system; click couple times (to focus the element first, then to emit the actuan event)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-InputPlayer input via keyboard, mouse, gamepad, and moreC-BugAn unexpected or incorrect behaviorO-WebSpecific to web (WASM) builds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions