From b2edbe617ef2ca015bf532ecfb8118b2b75c28c9 Mon Sep 17 00:00:00 2001 From: WesleyCh3n Date: Thu, 10 Nov 2022 22:00:20 +0800 Subject: [PATCH] Fixed Plot `Line::fill` does not fill last segment correctly (#2275) * Fix missing vertex to fill the triangle Co-authored-by: Emil Ernerfeldt --- crates/egui/src/widgets/plot/items/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/egui/src/widgets/plot/items/mod.rs b/crates/egui/src/widgets/plot/items/mod.rs index f8532aa2..6e106bf3 100644 --- a/crates/egui/src/widgets/plot/items/mod.rs +++ b/crates/egui/src/widgets/plot/items/mod.rs @@ -447,7 +447,7 @@ impl PlotItem for Line { let expected_intersections = 20; mesh.reserve_triangles((n_values - 1) * 2); mesh.reserve_vertices(n_values * 2 + expected_intersections); - values_tf[0..n_values - 1].windows(2).for_each(|w| { + values_tf.windows(2).for_each(|w| { let i = mesh.vertices.len() as u32; mesh.colored_vertex(w[0], fill_color); mesh.colored_vertex(pos2(w[0].x, y), fill_color);