mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
vertical scroll sequencer, pt.2
This commit is contained in:
parent
767b9ff983
commit
1ce5ab6f27
2 changed files with 20 additions and 4 deletions
|
|
@ -90,10 +90,26 @@ impl Handle<Tui> for PhraseEditor<Tui> {
|
|||
key!(KeyCode::Char('`')) => { self.mode = !self.mode; },
|
||||
key!(KeyCode::Enter) => { self.entered = true; },
|
||||
key!(KeyCode::Esc) => { self.entered = false; },
|
||||
key!(KeyCode::PageUp) => { self.note_axis.write().unwrap().start_dec(3); },
|
||||
key!(KeyCode::PageDown) => { self.note_axis.write().unwrap().start_inc(3); },
|
||||
key!(KeyCode::PageUp) => {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
axis.start_dec(3);
|
||||
axis.point_dec(3);
|
||||
},
|
||||
key!(KeyCode::PageDown) => {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
axis.start_inc(3);
|
||||
axis.point_inc(3);
|
||||
},
|
||||
key!(KeyCode::Up) => match self.entered {
|
||||
true => { self.note_axis.write().unwrap().point_dec(1); },
|
||||
true => {
|
||||
let mut axis = self.note_axis.write().unwrap();
|
||||
axis.point_dec(1);
|
||||
if let Some(point) = axis.point {
|
||||
if point < axis.start {
|
||||
axis.start = point;
|
||||
}
|
||||
}
|
||||
},
|
||||
false => { self.note_axis.write().unwrap().start_dec(1); },
|
||||
},
|
||||
key!(KeyCode::Down) => match self.entered {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ impl Content for PhraseEditor<Tui> {
|
|||
if let (Some(time), Some(note)) = (time_point, note_point) {
|
||||
let x1 = area.x() + (time / time_scale) as u16;
|
||||
let x2 = x1 + (self.note_len / time_scale) as u16;
|
||||
let y = area.y() + note as u16 / 2;
|
||||
let y = area.y() + note.saturating_sub(note_start) as u16 / 2;
|
||||
let c = if note % 2 == 0 { "▀" } else { "▄" };
|
||||
for x in x1..x2 {
|
||||
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue