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,