From b012554ca25a36b076d81cb3febcc9455d7df82e 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 f8532aa2a9c6..6e106bf37083 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);