Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

View: F8 on a right panel that isn't showing brings it forward in its mode

aiongg63ab092576a8
diff --git a/crates/ui-egui/src/docking.rs b/crates/ui-egui/src/docking.rs
index 017ffe842..2fc69e0da 100644
--- a/crates/ui-egui/src/docking.rs
+++ b/crates/ui-egui/src/docking.rs
@@ -229,6 +229,7 @@ pub(crate) fn reveal_command(app: &mut crate::LightcraftApp, id: &str) -> Result
// the sidebar it scrolls, also when it is a tab behind another panel
Some(Panel::Library)
} else if (id.starts_with("panel.") && id != "panel.close" && id != "panel.presets"
+ || id == "view.rightPanel"
|| id.starts_with("section.")
|| id.starts_with("tool.") && id != "tool.none")
&& app.ui.right != crate::state::RightPanel::None
diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs
index a162e6ca6..baf3d4514 100644
--- a/crates/ui-egui/src/menus.rs
+++ b/crates/ui-egui/src/menus.rs
@@ -865,7 +865,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
app.ui.tool.clear();
}
let _ = app.session.end_interaction();
- } else {
+ } else if app.ui.right == RightPanel::None {
let p = match std::mem::take(&mut app.ui.right_hidden) {
RightPanel::None => RightPanel::Edit,
p => p,
@@ -878,6 +878,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option<Re
app.ui.tool = "remove".into();
}
}
+ // A right panel that is open but not showing (minimized, or behind another tab)
+ // keeps its mode; reveal_command brings it to the front.
Ok(json!({"open": app.ui.right != RightPanel::None}))
}
"view.beforeAfter" => {
diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs
index 032548f6a..435936190 100644
--- a/crates/ui-egui/src/shortcuts.rs
+++ b/crates/ui-egui/src/shortcuts.rs
@@ -863,6 +863,24 @@ mod tests {
assert_eq!(h.app.ui.right, RightPanel::Edit);
}
+ /// F8 on a minimized Tools window opens it again in the mode it had.
+ #[test]
+ fn classic_f8_shows_a_minimized_tools_window_and_keeps_its_mode() {
+ use crate::{docking::Panel, state::RightPanel};
+ let mut h = library();
+ h.app.ui.view = crate::state::ViewMode::Detail;
+ h.app.ui.right = RightPanel::Edit;
+ h.settle(std::time::Duration::from_secs(10));
+ h.app.run("ui.dock", json!({"operation": "float", "panel": "tools", "rect": [400, 100, 320, 500]})).unwrap();
+ h.app.run("ui.dock", json!({"action": {"SetMinimized": {"panel": "tools", "minimized": true}}})).unwrap();
+ h.app.ui.right = RightPanel::Crop;
+ h.step();
+ assert!(!crate::docking::exposed(&h.app, Panel::Tools));
+ key(&mut h, "F8", false);
+ assert_eq!(h.app.ui.right, RightPanel::Crop);
+ assert!(crate::docking::exposed(&h.app, Panel::Tools), "the window opens");
+ }
+
#[test]
fn shift_culling_keys_advance_exactly_once() {
use lightcraft_catalog::{ColorLabel, Flag, PhotoId};