diff --git a/crates/story-render/src/main.rs b/crates/story-render/src/main.rs index 2af9566eb..1325d5b49 100644 --- a/crates/story-render/src/main.rs +++ b/crates/story-render/src/main.rs @@ -291,7 +291,7 @@ fn card(frames: &mut Frames, spec: &Spec, options: &Options) -> (Option, 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; } diff --git a/crates/ui-gallery/src/viewer/picks.rs b/crates/ui-gallery/src/viewer/picks.rs index 3a64525e5..0d8cde1bb 100644 --- a/crates/ui-gallery/src/viewer/picks.rs +++ b/crates/ui-gallery/src/viewer/picks.rs @@ -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 { + self.0.values_mut() + } + /// Forgets every story's state. pub fn clear(&mut self) { self.0.clear();