LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
KEYC-RATING: backslash keeps Show Original in the full-screen preview
Marco Arnulfo7b6eff73b30b
diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rsindex c82be1bf2..065056bf2 100644--- a/crates/ui-egui/src/shortcuts.rs+++ b/crates/ui-egui/src/shortcuts.rs@@ -298,14 +298,15 @@ fn matches(i: &egui::InputState, m: Modifiers, k: Key) -> bool {}/// Default brackets rate in grids, and the default backslash shows / hides the Filter Bar there-/// (Lightroom Classic's Library keys; Detail keeps brush size and Show Original). Remapped brush and-/// Show Original keys retain their action, and a saved assignment of the key to another command-/// takes precedence over this default.-fn grid_key_command(keymap: &Keymap, grid: bool, id: &'static str, shortcut: (Modifiers, Key)) -> Option<&'static str> {+/// (Lightroom Classic's Library keys; Detail keeps brush size and Show Original). The full-screen+/// preview keeps the grid's view but shows the photo alone, so backslash stays Show Original there.+/// Remapped brush and Show Original keys retain their action, and a saved assignment of the key to+/// another command takes precedence over this default.+fn grid_key_command(keymap: &Keymap, grid: bool, fullscreen: bool, id: &'static str, shortcut: (Modifiers, Key)) -> Option<&'static str> {let command = match (grid, id, shortcut) {(true, "brush.smaller", (m, Key::OpenBracket)) if m == Modifiers::NONE => "photo.decreaseRating",(true, "brush.larger", (m, Key::CloseBracket)) if m == Modifiers::NONE => "photo.increaseRating",- (true, "view.showOriginal", (m, Key::Backslash)) if m == Modifiers::NONE => "view.filterBar",+ (true, "view.showOriginal", (m, Key::Backslash)) if m == Modifiers::NONE && !fullscreen => "view.filterBar",_ => return Some(id),};if keymap.iter().any(|(other, sc)| other != id && find_bindable(other).is_some() && parse(sc) == Some(shortcut)) { None } else { Some(command) }@@ -392,7 +393,7 @@ pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) {&& !native(sc)&& !(k == Key::Escape && popup_open)&& matches(i, m, k)- && let Some(id) = grid_key_command(keymap, grid, b.id, (m, k))+ && let Some(id) = grid_key_command(keymap, grid, app.ui.fullscreen, b.id, (m, k)){fire.push(id.to_string());}diff --git a/crates/ui-egui/src/shortcuts/tests_filter_bar_key.rs b/crates/ui-egui/src/shortcuts/tests_filter_bar_key.rsindex cd05655ab..41d0b1c2d 100644--- a/crates/ui-egui/src/shortcuts/tests_filter_bar_key.rs+++ b/crates/ui-egui/src/shortcuts/tests_filter_bar_key.rs@@ -73,6 +73,22 @@ fn backslash_in_detail_still_shows_the_original() {assert_eq!(app.ui.view, ViewMode::Detail);}+/// F covers the grid with the photo alone: \ there is Show Original (latched), not the hidden Filter Bar.+#[test]+fn backslash_in_the_full_screen_preview_shows_the_original() {+ for view in [ViewMode::PhotoGrid, ViewMode::SquareGrid] {+ let mut app = app().unwrap();+ app.ui.view = view;+ app.run("view.fullScreenPreview", json!({})).unwrap();+ assert!(app.ui.fullscreen);+ let ctx = egui::Context::default();+ frame(&mut app, &ctx, Some(Key::Backslash), None);+ assert_eq!(app.ui.before_after, BeforeAfter::Original, "{view:?}: \\ latches the original");+ assert!(!app.ui.filter_bar, "{view:?}: the hidden Filter Bar is left alone");+ assert_eq!(app.ui.view, view, "the grid is the view behind the preview");+ }+}+#[test]fn saved_keymap_wins_over_the_grid_backslash() {let mut app = app().unwrap();diff --git a/docs/library-shortcuts.md b/docs/library-shortcuts.mdindex 515506cc9..211b00b76 100644--- a/docs/library-shortcuts.md+++ b/docs/library-shortcuts.md@@ -41,9 +41,9 @@ remapping and disabling the default brush bindings take precedence over their grThe separate Decrease Rating / Increase Rating commands can also be assigned in Help → Keyboard Shortcuts.`\` shows and hides the Filter Bar in Photo Grid and Square Grid, as in Lightroom Classic's Library; in-Detail it keeps showing the original (Develop's Before / After key). View → Filter Bar (`Shift+F`) works-in every view. A Show Original moved to another key keeps its meaning in the grids, and `\` given to-another command runs that command.+Detail and in the full-screen preview (`F`) it keeps showing the original (Develop's Before / After key).+View → Filter Bar (`Shift+F`) works in every view. A Show Original moved to another key keeps its meaning+in the grids, and `\` given to another command runs that command.Flag cycling and raise/lower use each photo's own flag, so a mixed selection steps together without being made uniform. Adobe's shortcut list names the backtick "Cycle flag settings" but does not state the order; unflagged → pick → reject is LightCraft's choice. The key is the logical grave key, so it follows the keyboard layout (on layouts where it is a dead accent key, assign another key in Help → Keyboard Shortcuts to `photo.cycleFlag`).