LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
KEYC-METADATA: Enable Painting leaves the full-screen preview and turns off adjustment tools
dotCooCoo831f4dd5f386
diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rsindex e08cd377f..0ac0a9a68 100644--- a/crates/ui-egui/src/menus/run.rs+++ b/crates/ui-egui/src/menus/run.rs@@ -232,15 +232,25 @@ fn ui_commands_1(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Valif 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" => {diff --git a/crates/ui-egui/src/tests/keywording.rs b/crates/ui-egui/src/tests/keywording.rsindex 5f8dad6ae..4e2908d10 100644--- a/crates/ui-egui/src/tests/keywording.rs+++ b/crates/ui-egui/src/tests/keywording.rs@@ -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]