Euclidean + hue rotation
This commit is contained in:
@@ -136,22 +136,15 @@ fn render_sequencer(frame: &mut Frame, app: &App, snapshot: &SequencerSnapshot,
|
||||
let num_rows = steps_on_page.div_ceil(8);
|
||||
let steps_per_row = steps_on_page.div_ceil(num_rows);
|
||||
|
||||
let spacing = num_rows.saturating_sub(1) as u16;
|
||||
let row_height = area.height.saturating_sub(spacing) / num_rows as u16;
|
||||
let row_height = area.height / num_rows as u16;
|
||||
|
||||
let row_constraints: Vec<Constraint> = (0..num_rows * 2 - 1)
|
||||
.map(|i| {
|
||||
if i % 2 == 0 {
|
||||
Constraint::Length(row_height)
|
||||
} else {
|
||||
Constraint::Length(1)
|
||||
}
|
||||
})
|
||||
let row_constraints: Vec<Constraint> = (0..num_rows)
|
||||
.map(|_| Constraint::Length(row_height))
|
||||
.collect();
|
||||
let rows = Layout::vertical(row_constraints).split(area);
|
||||
|
||||
for row_idx in 0..num_rows {
|
||||
let row_area = rows[row_idx * 2];
|
||||
let row_area = rows[row_idx];
|
||||
let start_step = row_idx * steps_per_row;
|
||||
let end_step = (start_step + steps_per_row).min(steps_on_page);
|
||||
let cols_in_row = end_step - start_step;
|
||||
@@ -226,6 +219,12 @@ fn render_tile(
|
||||
(false, false, false, _, _) => (theme.tile.inactive_bg, theme.tile.inactive_fg),
|
||||
};
|
||||
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_style(Style::new().fg(theme.ui.border));
|
||||
let inner = block.inner(area);
|
||||
frame.render_widget(block, area);
|
||||
|
||||
let source_idx = step.and_then(|s| s.source);
|
||||
let symbol = if is_playing {
|
||||
"▶".to_string()
|
||||
@@ -243,17 +242,17 @@ fn render_tile(
|
||||
};
|
||||
let num_lines = if step_name.is_some() { 2u16 } else { 1u16 };
|
||||
let content_height = num_lines;
|
||||
let y_offset = area.height.saturating_sub(content_height) / 2;
|
||||
let y_offset = inner.height.saturating_sub(content_height) / 2;
|
||||
|
||||
// Fill background for entire tile
|
||||
// Fill background for inner area
|
||||
let bg_fill = Paragraph::new("").style(Style::new().bg(bg));
|
||||
frame.render_widget(bg_fill, area);
|
||||
frame.render_widget(bg_fill, inner);
|
||||
|
||||
if let Some(name) = step_name {
|
||||
let name_area = Rect {
|
||||
x: area.x,
|
||||
y: area.y + y_offset,
|
||||
width: area.width,
|
||||
x: inner.x,
|
||||
y: inner.y + y_offset,
|
||||
width: inner.width,
|
||||
height: 1,
|
||||
};
|
||||
let name_widget = Paragraph::new(name.as_str())
|
||||
@@ -262,9 +261,9 @@ fn render_tile(
|
||||
frame.render_widget(name_widget, name_area);
|
||||
|
||||
let symbol_area = Rect {
|
||||
x: area.x,
|
||||
y: area.y + y_offset + 1,
|
||||
width: area.width,
|
||||
x: inner.x,
|
||||
y: inner.y + y_offset + 1,
|
||||
width: inner.width,
|
||||
height: 1,
|
||||
};
|
||||
let symbol_widget = Paragraph::new(symbol)
|
||||
@@ -273,9 +272,9 @@ fn render_tile(
|
||||
frame.render_widget(symbol_widget, symbol_area);
|
||||
} else {
|
||||
let centered_area = Rect {
|
||||
x: area.x,
|
||||
y: area.y + y_offset,
|
||||
width: area.width,
|
||||
x: inner.x,
|
||||
y: inner.y + y_offset,
|
||||
width: inner.width,
|
||||
height: 1,
|
||||
};
|
||||
let tile = Paragraph::new(symbol)
|
||||
|
||||
Reference in New Issue
Block a user