feat(ui): a Full screen button in the page controls (#2995) (#3209)

* 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 <[email protected]>

* Expose full screen button toggle state

* Check the rail toggle using its pinned accessibility contract

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: FredApps <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-12-04 15:08:30 +01:00
1 parent b026f59f32
commit ece4d2201d
2 files changed
+18 -1

No files matched your search

+2 -1
View File
@@ -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);
+16
View File
@@ -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<RightPanel> {
let state = pdfcraft_ui_egui::side_panels::state(app);