fix(ui): restore extras when showing the grid

This commit is contained in:
skylartaylor
2026-10-23 16:48:26 +00:00
parent e6d6fb45a4
commit eb88650d60
+25
View File
@@ -546,6 +546,10 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id:
};
*slot = !*slot;
let on = *slot;
if id == "view.show.grid" && on {
// Like the other Show items, enabling Grid also restores hidden Extras.
app.ui.view.extras = true;
}
if id == "view.rulers" {
crate::prefs_ui::remember_rulers(app, on);
}
@@ -1646,6 +1650,27 @@ pub fn apply_workspace(app: &mut PhotocraftApp) {
mod tests {
use super::*;
#[test]
fn showing_grid_restores_hidden_extras() {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
let ctx = egui::Context::default();
app.ui.extras.grid = false;
app.ui.view.extras = false;
assert_eq!(invoke(&mut app, &ctx, "view.show.grid", json!({})).unwrap(), json!(true));
assert_eq!(checked(&app, "view.show.grid"), Some(true));
assert!(app.ui.view.extras, "showing Grid must make the overlay visible when Extras was hidden");
assert_eq!(invoke(&mut app, &ctx, "view.show.grid", json!({})).unwrap(), json!(false));
assert!(!app.ui.extras.grid);
assert!(app.ui.view.extras);
app.ui.extras.grid = true;
app.ui.view.extras = false;
assert_eq!(invoke(&mut app, &ctx, "view.show.grid", json!({})).unwrap(), json!(false));
assert!(!app.ui.view.extras, "hiding Grid must leave hidden Extras alone");
}
#[test]
fn sync_with_system_menu_keeps_saved_slots_and_its_checkmark_across_palettes() {
use photocraft_engine::prefs::{AppearanceMode, DarkTheme, LightTheme};