fix(container): minSize should not add children's sizes, but take max instead
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 57s
Some checks failed
Zig Project Action / Lint, Spell-check and test zig project (push) Failing after 57s
This commit is contained in:
@@ -907,7 +907,7 @@ pub fn Container(Model: type, Event: type) type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn minSize(this: *const @This(), model: *const Model, size: Point) Point {
|
pub fn minSize(this: *const @This(), model: *const Model, size: Point) Point {
|
||||||
var min_size = this.element.minSize(model, size);
|
var min_size: Point = .{};
|
||||||
for (this.elements.items) |child| {
|
for (this.elements.items) |child| {
|
||||||
const child_size = child.minSize(model, child.properties.size.dim);
|
const child_size = child.minSize(model, child.properties.size.dim);
|
||||||
min_size = switch (this.properties.layout.direction) {
|
min_size = switch (this.properties.layout.direction) {
|
||||||
@@ -921,7 +921,11 @@ pub fn Container(Model: type, Event: type) type {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return min_size;
|
const element_size = this.element.minSize(model, size);
|
||||||
|
return .{
|
||||||
|
.x = @max(element_size.x, min_size.x),
|
||||||
|
.y = @max(element_size.y, min_size.y),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle(this: *const @This(), model: *Model, event: Event) !void {
|
pub fn handle(this: *const @This(), model: *Model, event: Event) !void {
|
||||||
|
|||||||
Reference in New Issue
Block a user