improve arranger selection display

This commit is contained in:
🪞👃🪞 2024-07-14 00:45:38 +03:00
parent cdb5390795
commit 41946cb095

View file

@ -80,13 +80,14 @@ render!(Arranger |self, buf, area| {
}); });
fill_bg(buf, area, Nord::bg_lo(self.focused, self.entered)); fill_bg(buf, area, Nord::bg_lo(self.focused, self.entered));
area = if self.mode { area = if self.mode {
self.draw_horizontal(buf, area) self.draw_horizontal(buf, area)?
} else { } else {
self.draw_vertical(buf, area) let area = self.draw_vertical(buf, area)?;
}?; if self.focused && self.entered && self.selected == ArrangerFocus::Mix {
if self.focused && self.entered { Corners(Style::default().green().not_dim()).draw(buf, area)?;
Corners(Style::default().green().not_dim()).draw(buf, area)?; };
} area
};
Ok(area) Ok(area)
}); });
@ -143,12 +144,16 @@ impl Arranger {
if playing { "" } else { " " }.blit(buf, x+1, y, style)?; if playing { "" } else { " " }.blit(buf, x+1, y, style)?;
scene.name.blit(buf, x + 2, y, style)?; scene.name.blit(buf, x + 2, y, style)?;
if self.selected.scene() == Some(scene_index) { if self.selected.scene() == Some(scene_index) {
let bg = if self.selected == ArrangerFocus::Scene(scene_index) { let selected = self.selected == ArrangerFocus::Scene(scene_index);
bg_hi let area = Rect { x, y, width, height: 2 };
if selected {
fill_bg(buf, area, bg_hi);
if self.focused && self.entered {
Corners(Style::default().green().not_dim()).draw(buf, area)?;
}
} else { } else {
bg_lo fill_bg(buf, area, bg_lo);
}; }
fill_bg(buf, Rect { x, y, width, height: 2 }, bg)
} }
} }
let width = 2 + self.scenes.iter() let width = 2 + self.scenes.iter()
@ -164,7 +169,7 @@ impl Arranger {
break break
} }
let width = 16u16; let width = 16u16;
track.name.blit(buf, x, y, Some(Style::default().bold()))?; track.name.blit(buf, x + 1, y, Some(Style::default().bold()))?;
for (scene_index, scene) in self.scenes.iter().enumerate() { for (scene_index, scene) in self.scenes.iter().enumerate() {
if y + 2 * scene_index as u16 >= height { if y + 2 * scene_index as u16 >= height {
break break
@ -186,11 +191,19 @@ impl Arranger {
if self.selected == ArrangerFocus::Clip(track_index, scene_index) { if self.selected == ArrangerFocus::Clip(track_index, scene_index) {
fill_bg(buf, Rect { x: area.x, y, width: area.width, height: 2 }, bg_lo); fill_bg(buf, Rect { x: area.x, y, width: area.width, height: 2 }, bg_lo);
fill_bg(buf, Rect { x, y: area.y, width, height: area.height }, bg_lo); fill_bg(buf, Rect { x, y: area.y, width, height: area.height }, bg_lo);
fill_bg(buf, Rect { x, y, width, height: 2 }, bg_hi); let area = Rect { x, y, width, height: 2 };
fill_bg(buf, area, bg_hi);
if self.focused && self.entered {
Corners(Style::default().green().not_dim()).draw(buf, area)?;
};
} }
} }
if self.selected == ArrangerFocus::Track(track_index) { if self.selected == ArrangerFocus::Track(track_index) {
fill_bg(buf, Rect { x, y: area.y, width, height: 1 }, bg_hi) fill_bg(buf, Rect { x, y: area.y, width, height: 1 }, bg_hi);
if self.focused && self.entered {
Corners(Style::default().green().not_dim())
.draw(buf, Rect { x, y: area.y, width, height })?;
};
} }
x = x + width as u16; x = x + width as u16;
} }