Painter extend accepts IntoIter (#2249)

* `Painter` extend accepts `IntoIter`

* Update painter.rs
This commit is contained in:
Max Wase
2022-11-07 09:32:28 +01:00
committed by GitHub
parent e48602059d
commit 22a917c00a
4 changed files with 41 additions and 36 deletions
+8 -6
View File
@@ -56,13 +56,15 @@ impl Painting {
response.mark_changed();
}
let mut shapes = vec![];
for line in &self.lines {
if line.len() >= 2 {
let shapes = self
.lines
.iter()
.filter(|line| line.len() >= 2)
.map(|line| {
let points: Vec<Pos2> = line.iter().map(|p| to_screen * *p).collect();
shapes.push(egui::Shape::line(points, self.stroke));
}
}
egui::Shape::line(points, self.stroke)
});
painter.extend(shapes);
response