SdfTerm: simplify get_order()

This commit is contained in:
Michael Sippel 2021-09-10 11:10:05 +02:00
parent b708545b96
commit 83386d5bd9
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -92,20 +92,18 @@ impl SdfTerm {
pub fn get_order(&mut self) -> Vec<LayerId> { pub fn get_order(&mut self) -> Vec<LayerId> {
vec![ vec![
self.bg_layers.iter().filter( self.bg_layers.iter(),
|(_pt, (active, _id))| *active self.fg_layers.iter()
)
.collect::<Vec<_>>()
.into_iter(),
self.fg_layers.iter().filter(
|(_pt, (active, _id))| *active
)
.collect::<Vec<_>>()
.into_iter()
] ]
.into_iter() .into_iter()
.flatten() .flatten()
.map(|(_,(_,id))| (*id).into()) .filter_map(
|(_pt,(active,id))|
if *active {
Some((*id).into())
} else {
None
})
.collect::<Vec<_>>() .collect::<Vec<_>>()
} }
@ -274,8 +272,6 @@ async fn main() {
Point2::new(0,0) .. Point2::new(new_size.x, new_size.y) Point2::new(0,0) .. Point2::new(new_size.x, new_size.y)
) )
); );
} }
TerminalEvent::Input(Event::Key(Key::Ctrl('c'))) | TerminalEvent::Input(Event::Key(Key::Ctrl('c'))) |
TerminalEvent::Input(Event::Key(Key::Ctrl('g'))) | TerminalEvent::Input(Event::Key(Key::Ctrl('g'))) |