Skip to content

Commit

Permalink
Fixed Plot Line::fill does not fill last segment correctly (#2275)
Browse files Browse the repository at this point in the history
* Fix missing vertex to fill the triangle

Co-authored-by: Emil Ernerfeldt <[email protected]>
  • Loading branch information
WesleyCh3n and emilk committed Dec 2, 2022
1 parent c377dde commit b012554
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/egui/src/widgets/plot/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b012554

Please sign in to comment.