WIP(container): fit_size call minSize for determining the minimal required size of a given Container
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:
@@ -723,6 +723,7 @@ pub fn Container(Model: type, Event: type) type {
|
||||
}
|
||||
}
|
||||
|
||||
size = this.minSize(&.{}, size);
|
||||
// assign currently calculated size
|
||||
this.size = switch (this.properties.size.grow) {
|
||||
.both => .max(size, this.properties.size.dim),
|
||||
@@ -889,20 +890,19 @@ pub fn Container(Model: type, Event: type) type {
|
||||
pub fn resize(this: *@This(), model: *const Model, size: Point) void {
|
||||
// NOTE assume that this function is only called for the root `Container`
|
||||
this.size = size;
|
||||
const fit_size: Point = .max(this.minSize(model, size), this.fit_resize());
|
||||
// if (fit_size.y > size.y or fit_size.x > size.x) @panic("error: cannot render in available space");
|
||||
switch (this.properties.size.grow) {
|
||||
.both => this.size = .max(size, fit_size),
|
||||
.fixed => {},
|
||||
.horizontal => this.size = .{
|
||||
const fit_size = this.fit_resize();
|
||||
this.size = switch (this.properties.size.grow) {
|
||||
.both => .max(size, fit_size),
|
||||
.fixed => fit_size,
|
||||
.horizontal => .{
|
||||
.x = @max(size.x, fit_size.x),
|
||||
.y = size.y,
|
||||
},
|
||||
.vertical => this.size = .{
|
||||
.vertical => .{
|
||||
.x = size.x,
|
||||
.y = @max(size.y, fit_size.y),
|
||||
},
|
||||
}
|
||||
};
|
||||
this.grow_resize(model, this.size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user