From ece4d2201d6968c20b95e89f36cbb4befe6549f5 Mon Sep 17 00:00:00 2001 From: Enrico Date: Fri, 4 Dec 2026 15:08:30 +0100 Subject: [PATCH] feat(ui): a Full screen button in the page controls (#2995) (#3209) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(ui): a Full screen button in the page controls (#2995) The page controls in the right rail had no way to enter Full screen mode; only View ▸ Full screen mode and Ctrl/Cmd+L did. A button directly below Zoom out now runs the existing view.full_screen command, after the view borrow ends as the Page display button does. It reuses the translated "Full screen mode" label and the shipped monitor icon, since the corner-bracket icons look like the fit toggle in the same column. Co-Authored-By: Claude Opus 5.5 * Expose full screen button toggle state * Check the rail toggle using its pinned accessibility contract --------- Co-authored-by: Claude Opus 5.5 Co-authored-by: FredApps --- crates/ui-egui/src/chrome/view_rail.rs | 3 ++- crates/ui-egui/tests/it/ui.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/chrome/view_rail.rs b/crates/ui-egui/src/chrome/view_rail.rs index fb743119ff..2c5114f8ec 100644 --- a/crates/ui-egui/src/chrome/view_rail.rs +++ b/crates/ui-egui/src/chrome/view_rail.rs @@ -5,7 +5,7 @@ use craft::behavior::kurbo::Size; use craft::behavior::{DockSide, IconId}; use craft::pages::PageDisplay; use craft::theme::TypeRole; -use craft::ui::buttons::IconButton; +use craft::ui::buttons::{IconButton, ToggleButton}; use craft::ui::contract::{Bind, PopupKind, Props as _, Show as _, ShowContainer as _, Trigger}; use craft::ui::display::Text; use craft::ui::menu::{Menu, MenuItem}; @@ -87,6 +87,7 @@ pub(crate) fn show(app: &mut PdfCraftApp, ui: &mut Ui) { IconButton::command(IconId::new("zoom_in"), "view.zoom.in").show(ui); IconButton::command(IconId::new("zoom_out"), "view.zoom.out").show(ui); + ToggleButton::command("view.full_screen").icon(IconId::new("monitor")).icon_only().show(ui); IconButton::command(IconId::new("maximize_2"), "view.fit_toggle").label(crate::commands::control_label("view.fit_toggle")).show(ui); IconButton::command(IconId::new("rotate_cw"), "view.rotate.cw").show(ui); diff --git a/crates/ui-egui/tests/it/ui.rs b/crates/ui-egui/tests/it/ui.rs index 97407f426f..cab97e322a 100644 --- a/crates/ui-egui/tests/it/ui.rs +++ b/crates/ui-egui/tests/it/ui.rs @@ -58,6 +58,22 @@ fn side(h: &mut Harness<'static, PdfCraftApp>, key: &str) -> String { pdfcraft_ui_egui::side_panels::state(h.state())[key].as_str().unwrap_or_default().to_owned() } +#[test] +fn page_controls_full_screen_button_enters_full_screen() { + let mut h = harness(|app| app.open_bytes(&egui::Context::default(), "fixture.pdf", None, FIXTURE.to_vec()).expect("fixture opens")); + h.run_steps(3); + let zoom_out = h.get_by_label("Zoom out").rect(); + let full_screen = h.get_by_label("Full screen mode"); + assert!(full_screen.rect().top() >= zoom_out.bottom(), "the full-screen button sits below Zoom out"); + // The pinned icon toggle omits the AccessKit property in its unpressed state. + assert_eq!(full_screen.accesskit_node().toggled(), None); + full_screen.click(); + h.run_steps(2); + assert!(h.state().full_screen()); + // Full-screen reading shows the document body alone, so the rail is hidden while on. + assert!(h.query_by_label("Full screen mode").is_none()); +} + /// The side panel the workspace has open, as `ui.state` reports it (`side_panel`). pub(crate) fn right(app: &PdfCraftApp) -> Option { let state = pdfcraft_ui_egui::side_panels::state(app);