mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 03:36:41 +01:00
23 lines
780 B
Rust
23 lines
780 B
Rust
use crate::*;
|
|
|
|
pub struct PianoHorizontalTimeline<'a>(pub(crate) &'a PianoHorizontal);
|
|
render!(<Tui>(self: PianoHorizontalTimeline<'a>)
|
|
|layout|Ok(Some([0, 0])),
|
|
|render|{
|
|
let [x, y, w, h] = render.area();
|
|
let style = Some(Style::default().dim());
|
|
let length = self.0.phrase.as_ref().map(|p|p.read().unwrap().length).unwrap_or(1);
|
|
for (area_x, screen_x) in (0..w).map(|d|(d, d+x)) {
|
|
let t = area_x as usize * self.0.time_zoom().get();
|
|
if t < length {
|
|
render.blit(&"|", screen_x, y, style);
|
|
}
|
|
}
|
|
Ok(())
|
|
});
|
|
|
|
//Tui::fg_bg(
|
|
//self.0.color.lightest.rgb,
|
|
//self.0.color.darkest.rgb,
|
|
//format!("{}*{}", self.0.time_start(), self.0.time_zoom()).as_str()
|
|
//));
|