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::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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue