From f7025a0fc2212b3c81bb182754792adf81298994 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Fri, 28 Nov 2025 14:34:32 +0100 Subject: [PATCH] fix(container): `minSize` should not add children's sizes, but take max instead --- src/container.zig | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/container.zig b/src/container.zig index 9880acf..7290981 100644 --- a/src/container.zig +++ b/src/container.zig @@ -907,7 +907,7 @@ pub fn Container(Model: type, Event: type) type { } pub fn minSize(this: *const @This(), model: *const Model, size: Point) Point { - var min_size = this.element.minSize(model, size); + var min_size: Point = .{}; for (this.elements.items) |child| { const child_size = child.minSize(model, child.properties.size.dim); min_size = switch (this.properties.layout.direction) { @@ -921,7 +921,11 @@ pub fn Container(Model: type, Event: type) type { }, }; } - return min_size; + const element_size = this.element.minSize(model, size); + return .{ + .x = @max(element_size.x, min_size.x), + .y = @max(element_size.y, min_size.y), + }; } pub fn handle(this: *const @This(), model: *Model, event: Event) !void {