wip: big flat pt.11, down to 12, update literal render macro

This commit is contained in:
🪞👃🪞 2024-12-30 21:25:02 +01:00
parent a0175dabc8
commit b718e54d33
9 changed files with 302 additions and 239 deletions

View file

@ -1,18 +1,21 @@
use crate::*;
pub struct PianoHorizontalTimeline<'a>(pub(crate) &'a PianoHorizontal);
render!(<Tui>|self: PianoHorizontalTimeline<'a>|render(|to: &mut TuiOutput|{
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().get();
if t < length {
to.blit(&"|", screen_x, y, style);
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(())
}));
Ok(())
});
//Tui::fg_bg(
//self.0.color.lightest.rgb,
//self.0.color.darkest.rgb,