mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +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<E, Self, W> {
|
||||||
Split::new(direction, amount, self, other)
|
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
|
self, direction: Direction, amount: E::Unit, other: W
|
||||||
) -> Split<E, W, Self> {
|
) -> Split<E, W, Self> {
|
||||||
Split::new(direction, amount, other, self)
|
Split::new(direction, amount, other, self)
|
||||||
|
|
@ -788,16 +788,11 @@ where
|
||||||
match self.1 {
|
match self.1 {
|
||||||
Direction::Down => {
|
Direction::Down => {
|
||||||
(self.0)(&mut |component| {
|
(self.0)(&mut |component| {
|
||||||
if h >= to.h() {
|
if h >= to.h() { return Ok(()) }
|
||||||
return Ok(())
|
let size = component.push_y(h).max_y(to.h() - h).layout(to)?;
|
||||||
}
|
|
||||||
let size = Push::Y(h, component as &dyn Widget<Engine = E>)
|
|
||||||
.layout(to)?;
|
|
||||||
if let Some([width, height]) = size.map(|size|size.wh()) {
|
if let Some([width, height]) = size.map(|size|size.wh()) {
|
||||||
h = h + height.into();
|
h = h + height.into();
|
||||||
if width > w {
|
if width > w { w = width; }
|
||||||
w = width;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
@ -807,13 +802,10 @@ where
|
||||||
if w >= to.w() {
|
if w >= to.w() {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
let size = Push::X(w, component as &dyn Widget<Engine = E>)
|
let size = component.push_x(w).max_x(to.w() - w).layout(to)?;
|
||||||
.layout(to)?;
|
|
||||||
if let Some([width, height]) = size.map(|size|size.wh()) {
|
if let Some([width, height]) = size.map(|size|size.wh()) {
|
||||||
w = w + width.into();
|
w = w + width.into();
|
||||||
if height > h {
|
if height > h { h = height }
|
||||||
h = height
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
@ -832,9 +824,7 @@ where
|
||||||
if h >= area.h() {
|
if h >= area.h() {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
// FIXME -> ???
|
let size = component.push_y(h).max_y(area.h() - h).layout(area.wh().into())?;
|
||||||
let size = Push::Y(h, component as &dyn Widget<Engine = E>)
|
|
||||||
.layout(area.wh().into())?;
|
|
||||||
if let Some([width, height]) = size.map(|size|size.wh()) {
|
if let Some([width, height]) = size.map(|size|size.wh()) {
|
||||||
Push::Y(h, component as &dyn Widget<Engine = E>).render(to)?;
|
Push::Y(h, component as &dyn Widget<Engine = E>).render(to)?;
|
||||||
h = h + height;
|
h = h + height;
|
||||||
|
|
@ -850,8 +840,7 @@ where
|
||||||
if w >= area.w() {
|
if w >= area.w() {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
}
|
}
|
||||||
let size = Push::X(w, component as &dyn Widget<Engine = E>)
|
let size = component.push_x(w).max_x(area.w() - w).layout(area.wh().into())?;
|
||||||
.layout(area.wh().into())?;
|
|
||||||
if let Some([width, height]) = size.map(|size|size.wh()) {
|
if let Some([width, height]) = size.map(|size|size.wh()) {
|
||||||
Push::X(w, component as &dyn Widget<Engine = E>).render(to)?;
|
Push::X(w, component as &dyn Widget<Engine = E>).render(to)?;
|
||||||
w = width + w;
|
w = width + w;
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,9 @@ impl Content for Arranger<Tui> {
|
||||||
add(&arrangement.split(
|
add(&arrangement.split(
|
||||||
direction,
|
direction,
|
||||||
20,
|
20,
|
||||||
self.phrases.clone()
|
self.phrases.clone().debug()
|
||||||
.split(direction.ccw(), 20, sequencer)
|
.split(direction.ccw(), 20, sequencer.debug())
|
||||||
.min_y(20)
|
.min_y(20)).debug())
|
||||||
))
|
|
||||||
} else {
|
} else {
|
||||||
add(&self.arrangement)
|
add(&self.arrangement)
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +29,7 @@ impl Content for Arranger<Tui> {
|
||||||
//add(modal as &dyn Widget<Engine = Tui>)?;
|
//add(modal as &dyn Widget<Engine = Tui>)?;
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
}).debug()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue