story-render: walk the gallery's kept story states through Cells::states_mut

This commit is contained in:
aiongg
2026-11-20 11:56:02 +00:00
parent 7e5db7494b
commit fbb1f0f911
2 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -291,7 +291,7 @@ fn card(frames: &mut Frames, spec: &Spec, options: &Options) -> (Option<Rect>, b
};
settle(frames, options.width, &mut |ui| rect = show(ui, &mut cells));
let mut opened = false;
for state in cells.values_mut().filter(|state| state.dialog.hidden) {
for state in cells.states_mut().filter(|state| state.dialog.hidden) {
state.show_dialog();
opened = true;
}
+5
View File
@@ -61,6 +61,11 @@ impl Cells {
self.0.iter_mut().filter(|(index, _)| indices.contains(index)).map(|(index, state)| (*index, state)).collect()
}
/// Every kept story's state, in index order.
pub fn states_mut(&mut self) -> impl Iterator<Item = &mut CardState> {
self.0.values_mut()
}
/// Forgets every story's state.
pub fn clear(&mut self) {
self.0.clear();