From d92f562a57cd4da91fc6e9663cc2be238bb73333 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Fri, 28 Nov 2025 15:03:50 +0100 Subject: [PATCH] WIP(container): propagate individual child sizes correctly --- src/container.zig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/container.zig b/src/container.zig index 7290981..49fde84 100644 --- a/src/container.zig +++ b/src/container.zig @@ -725,7 +725,7 @@ pub fn Container(Model: type, Event: type) type { // assign currently calculated size this.size = switch (this.properties.size.grow) { - .both => Point.max(size, this.properties.size.dim), + .both => .max(size, this.properties.size.dim), .fixed => this.properties.size.dim, .horizontal => .{ .x = @max(size.x, this.properties.size.dim.x), @@ -908,8 +908,10 @@ pub fn Container(Model: type, Event: type) type { pub fn minSize(this: *const @This(), model: *const Model, size: Point) Point { var min_size: Point = .{}; - for (this.elements.items) |child| { + for (this.elements.items) |*child| { const child_size = child.minSize(model, child.properties.size.dim); + child.properties.size.dim = child_size; + child.properties.size.grow = .fixed; min_size = switch (this.properties.layout.direction) { .horizontal => .{ .x = child_size.x + min_size.x, @@ -922,10 +924,7 @@ pub fn Container(Model: type, Event: type) type { }; } 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), - }; + return .max(element_size, min_size); } pub fn handle(this: *const @This(), model: *Model, event: Event) !void {