mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +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);
|
pub struct PianoHorizontalTimeline<'a>(&'a PianoHorizontal);
|
||||||
render!(|self: PianoHorizontalTimeline<'a>|Tui::fg_bg(
|
render!(|self: PianoHorizontalTimeline<'a>|render(|to|{
|
||||||
self.0.color.lightest.rgb,
|
let [x, y, w, h] = to.area();
|
||||||
self.0.color.darkest.rgb,
|
let style = Some(Style::default().dim());
|
||||||
format!("{}*{}", self.0.time_start(), self.0.time_zoom()).as_str()
|
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);
|
pub struct PianoHorizontalKeys<'a>(&'a PianoHorizontal);
|
||||||
render!(|self: PianoHorizontalKeys<'a>|render(|to|Ok({
|
render!(|self: PianoHorizontalKeys<'a>|render(|to|Ok({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue