bevyengine / bevyengine/bevy

Bevy UI, 2D and picking doesn't work correctly when DPR is changed in browser device emulator

Open
#25,306 10 comments 0 reactions 0 assignees View on GitHub
A-Input A-UI C-Bug S-Blocked
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version and features

0.19

## What you did

Open https://bevy.org/examples such as [feathers-gallery](https://bevy.org/examples/ui-user-interface/feathers-gallery/), [virtual-keyboard](https://bevy.org/examples/ui-user-interface/virtual-keyboard/), [drag-to-scroll](https://bevy.org/examples/ui-user-interface/drag-to-scroll/) on browser touch device emulation (where device pixel ratio / scale factor is 2.0 by default), or real touch screen where scale factor usually isn't 1.0 as well.

## What went wrong

UI elements look 2x larger with device pixel ratio = 2.0, and touch input doesn't work as expected.

https://github.com/user-attachments/assets/b3f437e6-f1ee-43ae-b269-f3c4479ccd60

https://github.com/user-attachments/assets/50b111f7-b7a6-4741-9134-503b1303e29e

https://github.com/user-attachments/assets/5e63d727-f41b-45c7-a9ce-58ce66469218

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the Bevy examples, such as feathers-gallery, virtual-keyboard, or drag-to-scroll, in browser touch-device emulation with device pixel ratio set to 2.0. Trace the UI sizing and touch-picking behavior, then verify that the elements render at the expected size and touch input works correctly at non-1.0 scale factors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
frontend, game-dev, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.