Portrait and square screens: world pixels, interface and zoom count on the shorter side

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-06 11:48:06 +01:00
1 parent 16857f1b9d
commit 25334e7b17
2 files changed
+18 -5

No files matched your search

+6 -1
View File
@@ -973,7 +973,12 @@ async fn main() {
// 900 rows (360 -> 1080), on a desktop and on a touch screen alike (a phone has about
// 1080 device rows in landscape; a smaller screen draws in device pixels)
let need: u32 = 900;
ui::set_virtual_rows(rows * need.div_ceil(rows));
// measured on the shorter side: upright (portrait) the width gets those pixels and the
// height grows with the screen, so the world and the menus keep their size
let short = rows * need.div_ceil(rows);
let (w, h) = (screen_width().max(1.0), screen_height().max(1.0));
let vrows = if h > w { (short as f32 * h / w).round() as u32 } else { short };
ui::set_virtual_rows(vrows);
if touch_mode {
// the pointer is the finger, or the position of this frame's gesture
let gpos = gestures.iter().rev().find_map(|g| match *g {