mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
wip: align timeline to notes area
This commit is contained in:
parent
775fea2c08
commit
5c630cc51b
1 changed files with 17 additions and 5 deletions
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue