From e972a2ea0f7a9f8caffd439ef206474b46475f91 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Fri, 28 Nov 2025 15:29:54 +0100 Subject: [PATCH] mod(container): integrate `minSize` call when `fit_resize` is calculated --- src/container.zig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/container.zig b/src/container.zig index 638ef64..a704995 100644 --- a/src/container.zig +++ b/src/container.zig @@ -685,7 +685,7 @@ pub fn Container(Model: type, Event: type) type { } /// Resize all fit sized `Containers` to the necessary size required by its child elements. - fn fit_resize(this: *@This()) Point { + fn fit_resize(this: *@This(), model: *const Model) Point { // NOTE this is supposed to be a simple and easy to understand algorithm, there are currently no optimizations done const layout = this.properties.layout; var size: Point = switch (layout.direction) { @@ -710,7 +710,7 @@ pub fn Container(Model: type, Event: type) type { }; for (this.elements.items) |*child| { - const child_size = child.fit_resize(); + const child_size = child.fit_resize(model); switch (layout.direction) { .horizontal => { size.x += child_size.x; @@ -723,7 +723,7 @@ pub fn Container(Model: type, Event: type) type { } } - size = this.minSize(&.{}, size); + size = this.minSize(model, size); // assign currently calculated size this.size = switch (this.properties.size.grow) { .both => .max(size, this.properties.size.dim), @@ -890,7 +890,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 = this.fit_resize(model); this.size = switch (this.properties.size.grow) { .both => .max(size, fit_size), .fixed => fit_size,