Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plot: Line styles #482

Merged
Prev Previous commit
address comments
  • Loading branch information
EmbersArc committed Jul 6, 2021
commit 5418cd7a195743f1b2d2344b9c297ef21952df37
2 changes: 1 addition & 1 deletion egui/src/widgets/plot/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl LineStyle {
&line,
stroke,
*length,
1.0 / golden_ratio,
length * golden_ratio,
))
}
}
Expand Down
13 changes: 3 additions & 10 deletions epaint/src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,10 @@ impl Shape {
points: &[Pos2],
stroke: impl Into<Stroke>,
dash_length: f32,
dash_gap_ratio: f32,
gap_length: f32,
) -> Vec<Self> {
let mut shapes = Vec::new();
dashes_from_line(
points,
stroke.into(),
dash_length,
dash_gap_ratio,
&mut shapes,
);
dashes_from_line(points, stroke.into(), dash_length, gap_length, &mut shapes);
shapes
}

Expand Down Expand Up @@ -219,10 +213,9 @@ fn dashes_from_line(
line: &[Pos2],
stroke: Stroke,
dash_length: f32,
dash_gap_ratio: f32,
gap_length: f32,
shapes: &mut Vec<Shape>,
) {
let gap_length = dash_length / dash_gap_ratio;
let mut position_on_segment = 0.0;
let mut drawing_dash = false;
line.windows(2).for_each(|window| {
Expand Down