mod(container): .horizontal and .vertical size.grow respect minSize value if no size.dim is used
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,13 +727,13 @@ 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 => if (this.properties.size.dim.x > 0 and this.properties.size.dim.y > 0) this.properties.size.dim else size,
|
||||||
.horizontal => .{
|
.horizontal => .{
|
||||||
.x = @max(size.x, this.properties.size.dim.x),
|
.x = @max(size.x, this.properties.size.dim.x),
|
||||||
.y = this.properties.size.dim.y,
|
.y = if (this.properties.size.dim.y > 0) this.properties.size.dim.y else size.y,
|
||||||
},
|
},
|
||||||
.vertical => .{
|
.vertical => .{
|
||||||
.x = this.properties.size.dim.x,
|
.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),
|
.y = @max(size.y, this.properties.size.dim.y),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,10 +53,7 @@ pub fn Element(Model: type, Event: type) type {
|
|||||||
pub inline fn minSize(this: @This(), model: *const Model, size: Point) Point {
|
pub inline fn minSize(this: @This(), model: *const Model, size: Point) Point {
|
||||||
if (this.vtable.minSize) |minSize_fn| {
|
if (this.vtable.minSize) |minSize_fn| {
|
||||||
const min_size = minSize_fn(this.ptr, model, size);
|
const min_size = minSize_fn(this.ptr, model, size);
|
||||||
return .{
|
return .max(size, min_size);
|
||||||
.x = @max(size.x, min_size.x),
|
|
||||||
.y = @max(size.y, min_size.y),
|
|
||||||
};
|
|
||||||
} else return size;
|
} else return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user