diff --git a/src/container.zig b/src/container.zig index 37591fc..e773fa5 100644 --- a/src/container.zig +++ b/src/container.zig @@ -727,14 +727,18 @@ pub fn Container(Model: type, Event: type) type { // assign currently calculated size this.size = switch (this.properties.size.grow) { .both => .max(size, this.properties.size.dim), - .fixed => if (this.properties.size.dim.x > 0 and this.properties.size.dim.y > 0) this.properties.size.dim else size, - .horizontal => .{ - .x = @max(size.x, this.properties.size.dim.x), - .y = if (this.properties.size.dim.y > 0) this.properties.size.dim.y else size.y, + .fixed => blk: { + assert(this.properties.size.dim.x > 0 or size.x > 0); + assert(this.properties.size.dim.y > 0 or size.y > 0); + break :blk .max(size, this.properties.size.dim); }, - .vertical => .{ - .x = if (this.properties.size.dim.x > 0) this.properties.size.dim.x else size.x, - .y = @max(size.y, this.properties.size.dim.y), + .horizontal => blk: { + assert(this.properties.size.dim.y > 0 or size.y > 0); + break :blk .max(size, this.properties.size.dim); + }, + .vertical => blk: { + assert(this.properties.size.dim.x > 0 or size.x > 0); + break :blk .max(size, this.properties.size.dim); }, }; return this.size;