wip: align timeline to notes area

This commit is contained in:
🪞👃🪞 2024-12-17 01:03:37 +01:00
parent 775fea2c08
commit 5c630cc51b

View file

@ -84,11 +84,23 @@ render!(|self: PianoHorizontal|{
});
pub struct PianoHorizontalTimeline<'a>(&'a PianoHorizontal);
render!(|self: PianoHorizontalTimeline<'a>|Tui::fg_bg(
self.0.color.lightest.rgb,
self.0.color.darkest.rgb,
format!("{}*{}", self.0.time_start(), self.0.time_zoom()).as_str()
));
render!(|self: PianoHorizontalTimeline<'a>|render(|to|{
let [x, y, w, h] = to.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();
if t < length {
to.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()
//));
pub struct PianoHorizontalKeys<'a>(&'a PianoHorizontal);
render!(|self: PianoHorizontalKeys<'a>|render(|to|Ok({