From 40fa080af6624551f011ddbf78906011a52dfc8c Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Fri, 28 Nov 2025 15:08:58 +0100 Subject: [PATCH] WIP(container): use another approach --- src/container.zig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/container.zig b/src/container.zig index 49fde84..eb37f26 100644 --- a/src/container.zig +++ b/src/container.zig @@ -889,7 +889,7 @@ pub fn Container(Model: type, Event: type) type { pub fn resize(this: *@This(), model: *const Model, size: Point) void { // NOTE assume that this function is only called for the root `Container` this.size = size; - const fit_size = this.fit_resize(); + const fit_size: Point = .max(this.minSize(model, size), this.fit_resize()); // if (fit_size.y > size.y or fit_size.x > size.x) @panic("error: cannot render in available space"); switch (this.properties.size.grow) { .both => this.size = .max(size, fit_size), @@ -910,8 +910,6 @@ pub fn Container(Model: type, Event: type) type { var min_size: Point = .{}; 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,