mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 23:49:35 +00:00
story-render: walk the gallery's kept story states through Cells::states_mut
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user