fix span sizing (still some layout tho)

This commit is contained in:
2025-11-18 17:52:45 -05:00
parent 9febd03067
commit db248de8f4
5 changed files with 24 additions and 9 deletions

View File

@@ -34,9 +34,8 @@ impl Widget for Span {
}
fn desired_size(&mut self, ctx: &mut SizeCtx) -> Size {
let mut sums = self.len_sum(ctx);
let sums = self.len_sum(ctx);
let dir_len = if sums.rest == 0.0 && sums.rel == 0.0 {
sums.abs += self.gap * self.children.len().saturating_sub(1) as f32;
sums
} else {
Len::default()
@@ -71,7 +70,8 @@ impl Span {
}
fn len_sum(&mut self, ctx: &mut SizeCtx) -> Len {
self.children.iter_mut().fold(Len::ZERO, |mut s, id| {
let gap = self.gap * self.children.len().saturating_sub(1) as f32;
self.children.iter_mut().fold(Len::abs(gap), |mut s, id| {
s += ctx.size(id).axis(self.dir.axis);
s
})