mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-27 19:47:35 -06:00
View: F8 on a right panel that isn't showing brings it forward in its mode
When the right panel is open but minimized or behind another tab, F8 keeps its mode instead of switching to the one it last hid, and view.rightPanel reveals Tools. Test: F8 on a minimized floating Tools window in Crop opens the window and stays in Crop.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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" => {
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user