mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 20:56:43 +01:00
draw x for no sample
This commit is contained in:
parent
b63a5e31ba
commit
f09a6072f8
1 changed files with 18 additions and 11 deletions
|
|
@ -6,16 +6,23 @@ pub struct SampleViewer<'a>(pub Option<&'a Arc<RwLock<Sample>>>);
|
||||||
render!(<Tui>|self: SampleViewer<'a>|render(|to|{
|
render!(<Tui>|self: SampleViewer<'a>|render(|to|{
|
||||||
let [x, y, width, height] = to.area();
|
let [x, y, width, height] = to.area();
|
||||||
let area = Rect { x, y, width, height };
|
let area = Rect { x, y, width, height };
|
||||||
Canvas::default()
|
let (x_bounds, y_bounds, coords): ([f64;2], [f64;2], &[(f64,f64)]) =
|
||||||
.x_bounds([0.0, f64::from(width)])
|
if let Some(sample) = self.0 {
|
||||||
.y_bounds([0.0, f64::from(height)])
|
let sample = sample.read().unwrap();
|
||||||
.paint(|ctx|{
|
(
|
||||||
ctx.draw(&Points {
|
[sample.start as f64, sample.end as f64],
|
||||||
coords: &[(0., 0.), (1., 2.), (3., 4.)],
|
[0 as f64, f32::MAX as f64],
|
||||||
color: Color::Rgb(255,0,0)
|
&[]
|
||||||
})
|
)
|
||||||
// TODO
|
} else {
|
||||||
})
|
(
|
||||||
.render(area, &mut to.buffer);
|
[0.0, f64::from(width)],
|
||||||
|
[0.0, f64::from(height)],
|
||||||
|
&[(0., 0.), (1., 1.), (2., 2.), (0., 2.), (2., 0.)]
|
||||||
|
)
|
||||||
|
};
|
||||||
|
Canvas::default().x_bounds(x_bounds).y_bounds(y_bounds).paint(|ctx|{
|
||||||
|
ctx.draw(&Points { coords, color: Color::Rgb(255,0,0) })
|
||||||
|
}).render(area, &mut to.buffer);
|
||||||
Ok(())
|
Ok(())
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue