constrain tracks from left side

This commit is contained in:
🪞👃🪞 2025-01-27 00:07:56 +01:00
parent e2023bdf53
commit 3502070613
5 changed files with 22 additions and 22 deletions

View file

@ -1,4 +1,5 @@
use crate::*;
use Color::*;
/// A clip, rendered as a horizontal piano roll.
pub struct PianoHorizontal {
pub clip: Option<Arc<RwLock<MidiClip>>>,
@ -82,7 +83,7 @@ impl PianoHorizontal {
}
/// Draw the piano roll background using full blocks on note on and half blocks on legato: █▄ █▄ █▄
fn draw_fg (buf: &mut BigBuffer, clip: &MidiClip, zoom: usize) {
let style = Style::default().fg(clip.color.base.rgb);//.bg(Color::Rgb(0, 0, 0));
let style = Style::default().fg(clip.color.base.rgb);//.bg(Rgb(0, 0, 0));
let mut notes_on = [false;128];
for (x, time_start) in (0..clip.length).step_by(zoom).enumerate() {
for (_y, note) in (0..=127).rev().enumerate() {
@ -182,9 +183,9 @@ impl PianoHorizontal {
let note_lo = state.note_lo().get();
let note_hi = state.note_hi();
let note_pos = state.note_pos();
let key_style = Some(Style::default().fg(Color::Rgb(192, 192, 192)).bg(Color::Rgb(0, 0, 0)));
let off_style = Some(Style::default().fg(Tui::g(160)));
let on_style = Some(Style::default().fg(Tui::g(255)).bg(color.base.rgb).bold());
let key_style = Some(Style::default().fg(Rgb(192, 192, 192)).bg(Rgb(0, 0, 0)));
let off_style = Some(Style::default().fg(Tui::g(255)));
let on_style = Some(Style::default().fg(Rgb(255,0,0)).bg(color.base.rgb).bold());
Fill::y(Fixed::x(self.keys_width, ThunkRender::new(move|to: &mut TuiOut|{
let [x, y0, _w, _h] = to.area().xywh();
for (_area_y, screen_y, note) in note_y_iter(note_lo, note_hi, y0) {