From 21198afa1124f533b28dcc88ee450c5417c1935a Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Thu, 19 Nov 2026 21:38:22 +0100 Subject: [PATCH] Match display selector rectangles to monitor aspect ratios --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/pdf-presenter/src/presenter_ui.rs | 14 +++++++++++--- docs/changelog.md | 8 ++++++++ docs/user-guide.md | 4 ++++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 61fb213..be6b550 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "pdf-presenter" -version = "0.1.28" +version = "0.1.29" dependencies = [ "bytemuck", "chrono", diff --git a/Cargo.toml b/Cargo.toml index c13b615..0dc2cd9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"] resolver = "3" [workspace.package] -version = "0.1.28" +version = "0.1.29" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" diff --git a/crates/pdf-presenter/src/presenter_ui.rs b/crates/pdf-presenter/src/presenter_ui.rs index 52e5023..6ddc2d6 100644 --- a/crates/pdf-presenter/src/presenter_ui.rs +++ b/crates/pdf-presenter/src/presenter_ui.rs @@ -773,8 +773,14 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) { .show(ui, |ui| { ui.set_min_width(540.); ui.horizontal(|ui| { - let (rect, _) = - ui.allocate_exact_size(Vec2::new(64., 40.), Sense::hover()); + let (slot, _) = + ui.allocate_exact_size(Vec2::splat(64.), Sense::hover()); + let dimensions = + Vec2::new(m.size.0.max(1) as f32, m.size.1.max(1) as f32); + let scale = + (slot.width() / dimensions.x).min(slot.height() / dimensions.y); + let rect = + Rect::from_center_size(slot.center(), dimensions * scale); ui.painter() .rect_filled(rect, 4., ui.visuals().extreme_bg_color); ui.painter().rect_stroke( @@ -787,7 +793,9 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) { rect.center(), egui::Align2::CENTER_CENTER, (index + 1).to_string(), - FontId::proportional(22.), + FontId::proportional( + 22_f32.min(rect.width() * 0.5).min(rect.height() * 0.65), + ), ui.visuals().text_color(), ); ui.vertical(|ui| { diff --git a/docs/changelog.md b/docs/changelog.md index c0e7202..9924717 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,14 @@ ## Unreleased +### 0.1.29 + +- Draw numbered screen rectangles in Displays using each monitor's pixel aspect + ratio, including portrait and ultrawide screens. Keep their slots aligned and + scale the screen number to fit. Linux tests, native X11 smoke, formatting, + Clippy/rustdoc and Python checks pass; whole-app coverage is 86.72%. + Physical multi-monitor and Windows/macOS validation were not run. + ### 0.1.28 - Add Shift+Space to move back one slide from the presenter; Space still advances. diff --git a/docs/user-guide.md b/docs/user-guide.md index cb41af3..a443226 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -189,6 +189,10 @@ Menu opens a dropdown below its button; click outside or press Escape to dismiss Displays uses numbered screen cards with direct Unused / Presenter / Presentation choices. Repeat a role to mirror it, then Apply and remember. +The numbered screen rectangles in **Displays** reflect each monitor’s pixel aspect +ratio, so portrait, standard and ultrawide displays are easier to distinguish. +They represent proportions, not physical screen size. + Menu → Appearance → Theme offers the same 20 built-in palettes as Canvas Pilot, including light, dark and High Contrast. Menu → Appearance → Language offers System, English and Français. System uses the native OS locale and falls back to English for other languages. Choices are