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> {
vec![
self.bg_layers.iter().filter(
|(_pt, (active, _id))| *active
)
.collect::<Vec<_>>()
.into_iter(),
self.fg_layers.iter().filter(
|(_pt, (active, _id))| *active
)
.collect::<Vec<_>>()
.into_iter()
self.bg_layers.iter(),
self.fg_layers.iter()
]
.into_iter()
.flatten()
.map(|(_,(_,id))| (*id).into())
.filter_map(
|(_pt,(active,id))|
if *active {
Some((*id).into())
} else {
None
})
.collect::<Vec<_>>()
}
@ -274,8 +272,6 @@ async fn main() {
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('g'))) |