KEYC-METADATA: Enable Painting leaves the full-screen preview and turns off adjustment tools

Cmd+Alt+K / Ctrl+Alt+K ends the full-screen preview before it opens the
Keywords panel or starts painting. With an empty keyword box it also turns
off an active targeted-adjustment tool and ends the current edit
interaction, as opening a panel from the menu does.
This commit is contained in:
dotCooCoo
2026-10-28 22:00:46 -07:00
parent fed2423f2c
commit 831f4dd5f3
2 changed files with 49 additions and 8 deletions
+18 -8
View File
@@ -232,15 +232,25 @@ fn ui_commands_1(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Val
if app.ui.keyword_painter.is_some() {
app.ui.keyword_painter = None;
Ok(json!({"keyword": null}))
} else if k.is_empty() {
app.ui.right = RightPanel::Keywords;
if app.ui.section_folded("keywording") {
app.ui.toggle_folded("keywording");
}
app.toast(ctx, crate::i18n::tr("Type a keyword to paint in the Keywords panel"));
Ok(json!({"keyword": null}))
} else {
run_ui_command(app, "tool.keywordPainter", &json!({"keyword": k})).unwrap_or(Ok(Value::Null))
// the full-screen preview covers both the grid and the Keywords panel
if app.ui.fullscreen {
crate::panels::slideshow::end(app);
}
if k.is_empty() {
app.ui.right = RightPanel::Keywords;
if app.ui.tool != "wbPicker" {
app.ui.tool.clear();
}
let _ = app.session.end_interaction();
if app.ui.section_folded("keywording") {
app.ui.toggle_folded("keywording");
}
app.toast(ctx, crate::i18n::tr("Type a keyword to paint in the Keywords panel"));
Ok(json!({"keyword": null}))
} else {
run_ui_command(app, "tool.keywordPainter", &json!({"keyword": k})).unwrap_or(Ok(Value::Null))
}
}
}
"view.secondWindow" => {
+31
View File
@@ -220,6 +220,37 @@ fn cmd_alt_k_paints_the_painters_keyword_and_stops() {
assert_eq!(h.app.ui.keyword_painter_text, "Weddings", "the box keeps the keyword");
}
/// In the full-screen preview, ⌘⌥K leaves the preview first: with an empty box the Keywords panel
/// shows, and with a keyword in the box the grid shows to paint on.
#[test]
fn cmd_alt_k_leaves_the_full_screen_preview() {
let (mut h, _) = two_selected();
let key = json!({"key": "K", "cmd": true, "alt": true});
h.app.run("view.fullScreenPreview", json!({})).unwrap();
assert!(h.app.ui.fullscreen);
ask(&mut h, "ui.key", key.clone());
assert!(!h.app.ui.fullscreen, "an empty box: the preview ends");
assert!(has(&h, "field:keywordPainter"), "the painter's box shows");
h.app.ui.keyword_painter_text = "Weddings".into();
h.app.run("view.fullScreenPreview", json!({})).unwrap();
assert!(h.app.ui.fullscreen);
ask(&mut h, "ui.key", key);
assert!(!h.app.ui.fullscreen, "a keyword in the box: the preview ends");
assert_eq!(h.app.ui.keyword_painter.as_deref(), Some("Weddings"));
}
/// ⌘⌥K with an empty box turns off a targeted-adjustment tool as it opens the Keywords panel, as
/// opening the panel any other way does.
#[test]
fn cmd_alt_k_turns_off_a_targeted_adjustment_tool() {
let (mut h, _) = two_selected();
ask(&mut h, "ui.set", json!({"view": "detail", "right": "edit"}));
h.app.ui.tool = "tat:curve".into();
ask(&mut h, "ui.key", json!({"key": "K", "cmd": true, "alt": true}));
assert_eq!(h.app.ui.right, crate::state::RightPanel::Keywords);
assert!(h.app.ui.tool.is_empty(), "the tool is off: {:?}", h.app.ui.tool);
}
/// Suggestions follow the selection: a keyword only some selected photos have is suggested, to give
/// it to all of them; one every selected photo has isn't.
#[test]