mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
partially fix Split component
This commit is contained in:
parent
5b0feddbcb
commit
0e6ad98fa5
2 changed files with 12 additions and 24 deletions
|
|
@ -237,7 +237,7 @@ pub trait Layout<E: Engine>: Widget<Engine = E> + Sized {
|
|||
) -> Split<E, Self, W> {
|
||||
Split::new(direction, amount, self, other)
|
||||
}
|
||||
fn split_reverse <W: Widget<Engine = E>> (
|
||||
fn split_flip <W: Widget<Engine = E>> (
|
||||
self, direction: Direction, amount: E::Unit, other: W
|
||||
) -> Split<E, W, Self> {
|
||||
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<Engine = E>)
|
||||
.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<Engine = E>)
|
||||
.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<Engine = E>)
|
||||
.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<Engine = E>).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<Engine = E>)
|
||||
.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<Engine = E>).render(to)?;
|
||||
w = width + w;
|
||||
|
|
|
|||
|
|
@ -16,10 +16,9 @@ impl Content for Arranger<Tui> {
|
|||
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<Tui> {
|
|||
//add(modal as &dyn Widget<Engine = Tui>)?;
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}).debug()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue