vertical scroll sequencer, pt.4

This commit is contained in:
🪞👃🪞 2024-10-28 23:41:19 +02:00
parent d1c892a235
commit 6665921de3
2 changed files with 12 additions and 4 deletions

View file

@ -113,7 +113,15 @@ impl Handle<Tui> for PhraseEditor<Tui> {
false => { self.note_axis.write().unwrap().start_dec(1); },
},
key!(KeyCode::Down) => match self.entered {
true => { self.note_axis.write().unwrap().point_inc(1); },
true => {
let mut axis = self.note_axis.write().unwrap();
axis.point_inc(1);
if let Some(point) = axis.point {
if point > 73 {
axis.point = Some(73);
}
}
},
false => { self.note_axis.write().unwrap().start_inc(1); },
},
key!(KeyCode::Left) => {

View file

@ -204,7 +204,7 @@ impl<E: Engine> PhraseEditor<E> {
}
}
fn redraw (phrase: &Phrase) -> BigBuffer {
let mut buf = BigBuffer::new(usize::MAX.min(phrase.length), 64);
let mut buf = BigBuffer::new(usize::MAX.min(phrase.length), 65);
Self::fill_seq_bg(&mut buf, phrase.length, phrase.ppq);
Self::fill_seq_fg(&mut buf, &phrase);
buf
@ -285,12 +285,12 @@ impl<E: Engine> PhraseEditor<E> {
}
/// Colors of piano keys
const KEY_COLORS: [(Color, Color);6] = [
(Color::Rgb(255, 255, 255), Color::Rgb(0, 0, 0)),
(Color::Rgb(255, 255, 255), Color::Rgb(0, 0, 0)),
(Color::Rgb(255, 255, 255), Color::Rgb(255, 255, 255)),
(Color::Rgb(0, 0, 0), Color::Rgb(255, 255, 255)),
(Color::Rgb(0, 0, 0), Color::Rgb(255, 255, 255)),
(Color::Rgb(0, 0, 0), Color::Rgb(255, 255, 255)),
(Color::Rgb(255, 255, 255), Color::Rgb(0, 0, 0)),
(Color::Rgb(255, 255, 255), Color::Rgb(0, 0, 0)),
];
pub(crate) fn keys_vert () -> Buffer {
let area = [0, 0, 5, 64];