WIP(container): use another approach
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:
@@ -889,7 +889,7 @@ 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 = this.fit_resize();
|
||||
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),
|
||||
@@ -910,8 +910,6 @@ pub fn Container(Model: type, Event: type) type {
|
||||
var min_size: Point = .{};
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user