From 6663f4efcba93a1db486696bcfe4ed53ce090930 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Thu, 2 Jan 2025 14:59:26 +0100 Subject: [PATCH] fix sampler alignment --- src/groovebox.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/groovebox.rs b/src/groovebox.rs index 1c17d149..442dbb4d 100644 --- a/src/groovebox.rs +++ b/src/groovebox.rs @@ -135,7 +135,7 @@ render!(Tui: (self: Groovebox) => { Bsp::w( Fixed::x(pool_w, Align::e(Fill::y(PoolView(&self.pool)))), Fill::xy(Bsp::e( - Align::w(Fixed::x(sampler_w, Fill::xy(GrooveboxSamples(self)))), + Fixed::x(sampler_w, Align::w(Fill::y(GrooveboxSamples(self)))), Bsp::s( Fill::x(Align::c(Bsp::e( PhraseSelector::play_phrase(&self.player), @@ -158,8 +158,7 @@ render!(Tui: (self: GrooveboxSamples<'a>) => { let note_lo = self.0.editor.note_lo().load(Relaxed); let note_pt = self.0.editor.note_point(); let note_hi = self.0.editor.note_hi(); - let range = move||(note_lo..=note_hi).rev(); - Fill::xy(Tui::map(range, move|note, i| { + Fill::xy(Tui::map(move||(note_lo..=note_hi).rev(), move|note, i| { let mut bg = if note == note_pt { TuiTheme::g(64) } else { Color::Reset }; let mut fg = TuiTheme::g(160); if let Some((index, _)) = self.0.sampler.recording { @@ -170,7 +169,8 @@ render!(Tui: (self: GrooveboxSamples<'a>) => { } else if self.0.sampler.mapped[note].is_some() { fg = TuiTheme::g(224); } - Push::y(i as u16, Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] { + let offset = |a|Push::y(i as u16, Align::n(Fixed::y(1, Fill::x(a)))); + offset(Tui::bg(bg, if let Some(sample) = &self.0.sampler.mapped[note] { Tui::fg(fg, format!("{note:3} ?????? ")) } else { Tui::fg(fg, format!("{note:3} (none) "))