feat(gui): size the UI for a finger on touch devices #28
No reviewers
Labels
No labels
agent
agent:ci
agent:done
agent:failed
agent:needs-input
agent:refined
agent:refining
agent:running
agent:skip
autonomous
driven
local
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jeroen/cartopolis!28
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/phone-usability"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reported from a Fairphone 4 on Chromium: the widgets are legible-but-tiny and
hard to hit. This is not a DPI bug —
egui_surfacealready feeds egui thedisplay's scale factor, which on the web is
devicePixelRatio, so text rendersat full device resolution. The layout is built for a mouse: a point on the web
is a CSS pixel, so
theme::style'sinteract_sizeof 40x24 pt is a 6.3 mmtouch target where the platform guidelines ask for ~10 mm.
EguiManager::ui_scalemagnifies on top of the display scale — 1.5x where thebrowser answers
(pointer: coarse), unconditionally on Android, 1.0 with amouse, and overridable per-device with
?ui_scale=/VIBERFOX_UI_SCALEsincethe physical size of a point varies by an octave across phones.
Scaling points-per-pixel rather than the theme's type scale, because a
style-only scale reaches only what the theme owns: the dock discs,
theme::close_button, the place pins, the HUD boxes and the driver rail allcarry their own point sizes and would have stayed put while the text grew.
1.5x is bounded from above by the panels, not the finger — the scale divides
the viewport as it multiplies the widgets, and
responsive_right_panelfloorsa compact panel at 240 pt, which 2x on a 393 pt phone would undercut.
The cost is that egui points and the window's logical points are no longer the
same number, and everything holding a position from
cursor_position,TouchInput::positionorworld_to_viewportwas silently correct only becausethey were. A sweep of every
egui::pos2construction found five: the pointerbridge (converted at the single entry point, so
state.lastand the buttonevents built from it are already in egui's space), the context menu, the place
pins, the POI popup, the marquee rect — and
boot_splash, which sized itsbackdrop from
Window::width(). The splash keeps its window query as a gate,which is what holds it out of headless
--shotcaptures.