diff --git a/src/container.zig b/src/container.zig index 142ebf0..9c07b4c 100644 --- a/src/container.zig +++ b/src/container.zig @@ -697,13 +697,11 @@ pub fn Container(comptime Event: type) type { .y = @max(size.y, this.properties.size.dim.y), }, }; - log.debug("fit_size returning: {any}", .{this.size}); return this.size; } /// growable implicitly requires the root `Container` to have a set a size property to the size of the available terminal screen fn grow_resize(this: *@This(), max_size: Point) void { - log.debug("grow_size: {any}", .{this.size}); const layout = this.properties.layout; var remainder = switch (layout.direction) { .horizontal => max_size.x -| (layout.padding.left + layout.padding.right), @@ -787,6 +785,10 @@ pub fn Container(comptime Event: type) type { for (this.elements.items) |child| { if (child.properties.size.grow == .fixed) continue; + switch (layout.direction) { + .horizontal => if (child.properties.size.grow == .vertical) continue, + .vertical => if (child.properties.size.grow == .horizontal) continue, + } const size = switch (layout.direction) { .horizontal => child.size.x, @@ -817,9 +819,11 @@ pub fn Container(comptime Event: type) type { switch (layout.direction) { .horizontal => if (child.properties.size.grow != .vertical) { child.size.x += size_to_correct; + remainder -|= size_to_correct; }, .vertical => if (child.properties.size.grow != .horizontal) { child.size.y += size_to_correct; + remainder -|= size_to_correct; }, } if (overflow > 0) { @@ -836,7 +840,6 @@ pub fn Container(comptime Event: type) type { }, } } - remainder -|= size_to_correct; } } }