mod(container): make reposition public and split from resize
All checks were successful
Zig Project Action / Lint, Spell-check and test zig project (push) Successful in 1m3s

This commit is contained in:
2025-03-13 19:48:31 +01:00
parent dddc09b4ce
commit 54af974c2b
14 changed files with 38 additions and 19 deletions

View File

@@ -616,7 +616,7 @@ pub fn Container(comptime Event: type) type {
try this.elements.append(element);
}
fn reposition(this: *@This(), origin: Point) void {
pub fn reposition(this: *@This(), origin: Point) void {
const layout = this.properties.layout;
this.origin = origin;
this.element.reposition(origin);
@@ -701,7 +701,7 @@ pub fn Container(comptime Event: type) type {
return this.size;
}
// growable implicitly requires the root `Container` to have a set a size property to the size of the available terminal screen
/// growable implicitly requires the root `Container` to have a set a size property to the size of the available terminal screen
fn grow_resize(this: *@This(), max_size: Point) void {
log.debug("grow_size: {any}", .{this.size});
const layout = this.properties.layout;
@@ -845,7 +845,7 @@ pub fn Container(comptime Event: type) type {
for (this.elements.items) |*child| child.grow_resize(child.size);
}
pub fn resize(this: *@This(), origin: Point, size: Point) void {
pub fn resize(this: *@This(), size: Point) void {
// NOTE assume that this function is only called for the root `Container`
const fit_size = this.fit_resize();
// if (fit_size.y > size.y or fit_size.x > size.x) @panic("error: cannot render in available space");
@@ -862,7 +862,6 @@ pub fn Container(comptime Event: type) type {
},
}
this.grow_resize(this.size);
this.reposition(origin);
}
pub fn handle(this: *@This(), event: Event) !void {