diff --git a/crates/tek_core/src/space.rs b/crates/tek_core/src/space.rs index cba04bc4..329fb302 100644 --- a/crates/tek_core/src/space.rs +++ b/crates/tek_core/src/space.rs @@ -237,7 +237,7 @@ pub trait Layout: Widget + Sized { ) -> Split { Split::new(direction, amount, self, other) } - fn split_reverse > ( + fn split_flip > ( self, direction: Direction, amount: E::Unit, other: W ) -> Split { Split::new(direction, amount, other, self) @@ -788,16 +788,11 @@ where match self.1 { Direction::Down => { (self.0)(&mut |component| { - if h >= to.h() { - return Ok(()) - } - let size = Push::Y(h, component as &dyn Widget) - .layout(to)?; + if h >= to.h() { return Ok(()) } + let size = component.push_y(h).max_y(to.h() - h).layout(to)?; if let Some([width, height]) = size.map(|size|size.wh()) { h = h + height.into(); - if width > w { - w = width; - } + if width > w { w = width; } } Ok(()) })?; @@ -807,13 +802,10 @@ where if w >= to.w() { return Ok(()) } - let size = Push::X(w, component as &dyn Widget) - .layout(to)?; + let size = component.push_x(w).max_x(to.w() - w).layout(to)?; if let Some([width, height]) = size.map(|size|size.wh()) { w = w + width.into(); - if height > h { - h = height - } + if height > h { h = height } } Ok(()) })?; @@ -832,9 +824,7 @@ where if h >= area.h() { return Ok(()) } - // FIXME -> ??? - let size = Push::Y(h, component as &dyn Widget) - .layout(area.wh().into())?; + let size = component.push_y(h).max_y(area.h() - h).layout(area.wh().into())?; if let Some([width, height]) = size.map(|size|size.wh()) { Push::Y(h, component as &dyn Widget).render(to)?; h = h + height; @@ -850,8 +840,7 @@ where if w >= area.w() { return Ok(()) } - let size = Push::X(w, component as &dyn Widget) - .layout(area.wh().into())?; + let size = component.push_x(w).max_x(area.w() - w).layout(area.wh().into())?; if let Some([width, height]) = size.map(|size|size.wh()) { Push::X(w, component as &dyn Widget).render(to)?; w = width + w; diff --git a/crates/tek_sequencer/src/arranger_tui.rs b/crates/tek_sequencer/src/arranger_tui.rs index b194b4ea..a3161712 100644 --- a/crates/tek_sequencer/src/arranger_tui.rs +++ b/crates/tek_sequencer/src/arranger_tui.rs @@ -16,10 +16,9 @@ impl Content for Arranger { add(&arrangement.split( direction, 20, - self.phrases.clone() - .split(direction.ccw(), 20, sequencer) - .min_y(20) - )) + self.phrases.clone().debug() + .split(direction.ccw(), 20, sequencer.debug()) + .min_y(20)).debug()) } else { add(&self.arrangement) } @@ -30,7 +29,7 @@ impl Content for Arranger { //add(modal as &dyn Widget)?; } Ok(()) - }) + }).debug() } }