fix: FlowBox always lays out children

This commit is contained in:
LordMZTE 2023-01-14 14:13:33 +01:00
parent c7f98cf115
commit 98f3837c81
Signed by: LordMZTE
GPG Key ID: B64802DC33A64FF6
1 changed files with 7 additions and 12 deletions

View File

@ -49,6 +49,7 @@ pub fn deinit(self: *Self) void {
}
fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) anyerror!void {
_ = final_pass;
switch (self.direction) {
.vertical => {
// the maximum width of the children
@ -111,12 +112,9 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
.height = child_height,
});
// TODO: really only layout children on the final pass?
if (final_pass) {
try child.layout(ctx, child_cons, true);
if (!child.data.overflow)
try child_cons.assertFits(child.data.size);
}
try child.layout(ctx, child_cons, true);
if (!child.data.overflow)
try child_cons.assertFits(child.data.size);
}
self.child_offsets[i] = cur_pos;
@ -192,12 +190,9 @@ fn layout(self: *Self, ctx: *LayoutCtx, cons: Constraints, final_pass: bool) any
.height = child.data.size.height,
});
// TODO: really only layout children on the final pass?
if (final_pass) {
try child.layout(ctx, child_cons, true);
if (!child.data.overflow)
try child_cons.assertFits(child.data.size);
}
try child.layout(ctx, child_cons, true);
if (!child.data.overflow)
try child_cons.assertFits(child.data.size);
}
self.child_offsets[i] = cur_pos;