Drive develop, the grid, the sidebar and People from the keyboard
An audit of every action by view against the keys the handlers bind left develop without zoom, pan, fit or a way back to the grid, the grid without select-none, thumbnail size or keywording, People with no key at all, and the export and copy sheets without Enter. It also found the reverse gap FR-UI-5 forbids: pick and reject had no route but P, X and U, and the 2026-09-19 amendment's judging in develop had not been built. Develop: Ctrl+= and Ctrl+Plus zoom in and Ctrl+- out about the middle of the view, Ctrl+0 fits and Ctrl+1 goes to 1:1, Shift and an arrow pan a magnified view, G goes back to the grid, Ctrl+Y redoes, and Enter keeps a crop that hid a mask. 0-5, P, X and U rate and flag the open photograph without moving on, with stars and Pick/Reject in the top bar as the pointer and touch route. = and - nudge the control last moved by a hundredth of its travel; the framing sliders, perspective included, now count as "last moved", so R puts them back as well. J turns the selected mask part's join chip. Grid: Ctrl+D and Ctrl+Shift+A clear the selection, = and - resize the thumbnails, Ctrl+K opens keywording, and Flag in the selection bar gives pick and reject a pointer and touch route. Sidebar: Enter commits a collection's name, and Enter or Escape hands the keyboard back to the grid, where it used to go nowhere until something was clicked. People: Up and Down walk the rail, F2 puts the name field under the keys, and Escape or Back now leave the screen the way its back button does instead of doing nothing. Sheets: Enter does what the export or copy sheet's button does. The choices follow Lightroom where it has one. No new key steals typing: the grid's and People's keys live on focus holders that are not ancestors of any text field, and the sheets' Enter comes after a focused field has had it. Every binding is tagged beside its handler, and the gate added in the previous commit holds the two to each other.
This commit is contained in:
@@ -798,6 +798,44 @@ fn wire_navigation(
|
||||
reset_name_field(&w);
|
||||
});
|
||||
}
|
||||
|
||||
// TRACES: FR-UI-5
|
||||
// Up and down the rail from the keyboard. The rail's order is the model's
|
||||
// order, so the neighbour is found there and then picked exactly as a
|
||||
// click on it would pick it — one path for selecting a person, whichever
|
||||
// way it was asked for. Stops at either end rather than wrapping: a rail
|
||||
// of two thousand people that jumped from the last to the first would
|
||||
// lose the user's place.
|
||||
{
|
||||
let weak = window.as_weak();
|
||||
window.on_identity_person_stepped(move |delta| {
|
||||
let Some(w) = weak.upgrade() else { return };
|
||||
let people = w.get_identity_people();
|
||||
let ids: Vec<i32> = people.iter().map(|p| p.id).collect();
|
||||
if let Some(id) = stepped_person(&ids, w.get_identity_selected(), delta) {
|
||||
w.invoke_identity_person_picked(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// The person `delta` places along the rail from `selected`, or `None` where
|
||||
/// that is off either end or the rail is empty. With nobody selected, the
|
||||
/// first key down the rail takes the first person and up takes the last.
|
||||
fn stepped_person(ids: &[i32], selected: i32, delta: i32) -> Option<i32> {
|
||||
let last = ids.len().checked_sub(1)?;
|
||||
let next = match ids.iter().position(|id| *id == selected) {
|
||||
Some(at) => {
|
||||
let to = at as i64 + delta.signum() as i64;
|
||||
if to < 0 || to > last as i64 {
|
||||
return None;
|
||||
}
|
||||
to as usize
|
||||
}
|
||||
None if delta < 0 => last,
|
||||
None => 0,
|
||||
};
|
||||
ids.get(next).copied()
|
||||
}
|
||||
|
||||
/// Renaming a person, and the namesake merge offer a rename can raise.
|
||||
@@ -1600,6 +1638,21 @@ fn park_cover_timer(timer: Option<slint::Timer>) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::stepped_person;
|
||||
|
||||
/// TRACES: FR-UI-5
|
||||
#[test]
|
||||
fn stepping_the_rail_stops_at_either_end() {
|
||||
let rail = [7, 3, 9];
|
||||
assert_eq!(stepped_person(&rail, 3, 1), Some(9));
|
||||
assert_eq!(stepped_person(&rail, 3, -1), Some(7));
|
||||
assert_eq!(stepped_person(&rail, 9, 1), None);
|
||||
assert_eq!(stepped_person(&rail, 7, -1), None);
|
||||
assert_eq!(stepped_person(&rail, -1, 1), Some(7));
|
||||
assert_eq!(stepped_person(&rail, -1, -1), Some(9));
|
||||
assert_eq!(stepped_person(&[], -1, 1), None);
|
||||
}
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user