wip: replacing Rect with [u16;4] in mixer and sequencer

This commit is contained in:
🪞👃🪞 2024-09-07 12:50:52 +03:00
parent fa739a49b2
commit 06f8bd1116
14 changed files with 106 additions and 106 deletions

View file

@ -2,7 +2,7 @@ use crate::*;
use tek_core::Direction;
impl Render<Tui> for Track<Tui> {
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
TrackView {
chain: Some(&self),
direction: tek_core::Direction::Right,
@ -31,7 +31,7 @@ pub struct TrackView<'a, E: Engine> {
pub entered: bool,
}
impl<'a> Render<Tui> for TrackView<'a, Tui> {
fn render (&self, to: &mut Tui) -> Perhaps<Rect> {
fn render (&self, to: &mut Tui) -> Perhaps<[u16;4]> {
let mut area = to.area();
if let Some(chain) = self.chain {
match self.direction {
@ -50,7 +50,7 @@ impl<'a> Render<Tui> for TrackView<'a, Tui> {
}
Ok(Some(area))
} else {
let Rect { x, y, width, height } = area;
let [x, y, width, height] = area;
let label = "No chain selected";
let x = x + (width - label.len() as u16) / 2;
let y = y + height / 2;