mod(container): Size property handling for .fixed, .horizontal and .vertical check with assertions required values
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m0s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 1m0s
This commit is contained in:
@@ -727,14 +727,18 @@ pub fn Container(Model: type, Event: type) type {
|
|||||||
// assign currently calculated size
|
// assign currently calculated size
|
||||||
this.size = switch (this.properties.size.grow) {
|
this.size = switch (this.properties.size.grow) {
|
||||||
.both => .max(size, this.properties.size.dim),
|
.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,
|
.fixed => blk: {
|
||||||
.horizontal => .{
|
assert(this.properties.size.dim.x > 0 or size.x > 0);
|
||||||
.x = @max(size.x, this.properties.size.dim.x),
|
assert(this.properties.size.dim.y > 0 or size.y > 0);
|
||||||
.y = if (this.properties.size.dim.y > 0) this.properties.size.dim.y else size.y,
|
break :blk .max(size, this.properties.size.dim);
|
||||||
},
|
},
|
||||||
.vertical => .{
|
.horizontal => blk: {
|
||||||
.x = if (this.properties.size.dim.x > 0) this.properties.size.dim.x else size.x,
|
assert(this.properties.size.dim.y > 0 or size.y > 0);
|
||||||
.y = @max(size.y, this.properties.size.dim.y),
|
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;
|
return this.size;
|
||||||
|
|||||||
Reference in New Issue
Block a user