WIP(container): propagate individual child sizes correctly
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:
@@ -725,7 +725,7 @@ pub fn Container(Model: type, Event: type) type {
|
||||
|
||||
// assign currently calculated size
|
||||
this.size = switch (this.properties.size.grow) {
|
||||
.both => Point.max(size, this.properties.size.dim),
|
||||
.both => .max(size, this.properties.size.dim),
|
||||
.fixed => this.properties.size.dim,
|
||||
.horizontal => .{
|
||||
.x = @max(size.x, this.properties.size.dim.x),
|
||||
@@ -908,8 +908,10 @@ pub fn Container(Model: type, Event: type) type {
|
||||
|
||||
pub fn minSize(this: *const @This(), model: *const Model, size: Point) Point {
|
||||
var min_size: Point = .{};
|
||||
for (this.elements.items) |child| {
|
||||
for (this.elements.items) |*child| {
|
||||
const child_size = child.minSize(model, child.properties.size.dim);
|
||||
child.properties.size.dim = child_size;
|
||||
child.properties.size.grow = .fixed;
|
||||
min_size = switch (this.properties.layout.direction) {
|
||||
.horizontal => .{
|
||||
.x = child_size.x + min_size.x,
|
||||
@@ -922,10 +924,7 @@ pub fn Container(Model: type, Event: type) type {
|
||||
};
|
||||
}
|
||||
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),
|
||||
};
|
||||
return .max(element_size, min_size);
|
||||
}
|
||||
|
||||
pub fn handle(this: *const @This(), model: *Model, event: Event) !void {
|
||||
|
||||
Reference in New Issue
Block a user