fix: improve anti-clipping for graphs
This commit is contained in:
parent
d1fb0ca78a
commit
d3f94b4acc
1 changed files with 2 additions and 1 deletions
|
|
@ -55,7 +55,8 @@ impl canvas::Program<app::Message, Theme, Renderer> for Graph {
|
|||
&canvas::Path::new(|builder| {
|
||||
for (index, value) in self.timeline.iter().enumerate() {
|
||||
let x = index as f32 / self.timeline.len() as f32 * bounds.width;
|
||||
let y = bounds.height - value / 100. * bounds.height - 1.;
|
||||
let y = (bounds.height - value / 100. * bounds.height)
|
||||
.clamp(1., bounds.height - 1.);
|
||||
builder.line_to(Point::new(x, y))
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue