Step along the roll by library ordinal, and keep its mark on the open photograph
In a library's develop view the arrows, space, A and D opened `library-roll-pick(library-roll-current ± 1)`. `roll-current` is a row of the loaded window, set when a photograph was opened and never again. Two things followed on any library larger than one window: - Holding D stopped dead at the end of the loaded window: the pick of a row past `ctl.paths` found no path and did nothing, a few screenfuls into a library of thousands. A stopped at its start the same way. - Any reload of the window — a background sync, a judgement that drops the open frame out of a filter — left `roll-current` on a row that now held another photograph. The roll marked it, develop's rating keys judged it, and the next step walked on from it. The keys now call `library-roll-step(delta)`, and Rust steps as `move_cursor` does in the grid: from the open photograph's ordinal (`index`, which `report_position` already keeps), clamped to the library, loading the window around the target only when it lies outside. The window-bringing half of `place_cursor` is shared for this as `bring_window_to`, so the grid cursor and the roll move the window the same way. Catalog reads stay proportional to the window: one `load_window` per window crossed, none per step within it. The open photograph is also remembered by image id. Every `load_window` finds it again in the rows it just read (a scan of one window, no query), puts `roll-current` and `index` back on it, or takes the mark off when it is not there. When it is missing but its ordinal is still inside the window, it has left the grid and its successor moved up into its place, so the next step forward lands on that ordinal instead of skipping the successor. A click on the roll still reports a row; it is right because the cells it is drawn from and `ctl.paths` are replaced together, and it now goes through the same open path as a step. Fixes #64.
This commit is contained in:
@@ -18,7 +18,7 @@ use crate::{AppWindow, Library, TimelineBar, View};
|
||||
|
||||
use super::controller::LibraryController;
|
||||
use super::filter_bar::{push_people_chips, refilter};
|
||||
use super::window::{load_window, window_start};
|
||||
use super::window::{load_window, mark_open, window_start};
|
||||
|
||||
/// Move the timeline's zoom by whole levels.
|
||||
///
|
||||
@@ -814,9 +814,7 @@ pub(crate) fn apply_place(
|
||||
window.global::<Library>().set_library_roll_centre(true);
|
||||
let offset = *ctl.offset.borrow();
|
||||
if let Some(row) = at.checked_sub(offset) {
|
||||
window
|
||||
.global::<Library>()
|
||||
.set_library_roll_current(row as i32);
|
||||
mark_open(window, ctl, row);
|
||||
}
|
||||
open(place.path.clone());
|
||||
// After the open, which resets the readout to "1 of 1" on its
|
||||
|
||||
Reference in New Issue
Block a user