ref(event): split resize event into viewport and size event

Viewport event reflects the absolut position and size of a given
container (and propagates them to its children). While the size
event propagates the content size to its children (and sets their
corresponding member values accordingly).

Both events are currently only emitted by `Container`s meaning that they
don't need to be part of the event loop and that they might be removed
later.
This commit is contained in:
2025-02-15 09:55:30 +01:00
parent 01d121ef87
commit 09a659ba70
4 changed files with 250 additions and 139 deletions

View File

@@ -32,14 +32,14 @@ pub fn main() !void {
},
.layout = .{
.padding = .all(5),
.direction = .vertical,
.direction = .horizontal,
},
});
var box = try App.Container.init(allocator, .{
.rectangle = .{ .fill = .blue },
.layout = .{
.gap = 1,
.direction = .horizontal,
.direction = .vertical,
.padding = .vertical(1),
},
});
@@ -92,9 +92,7 @@ pub fn main() !void {
});
}
},
.err => |err| {
log.err("Received {any} with message: {s}", .{ @errorName(err.err), err.msg });
},
.err => |err| log.err("Received {any} with message: {s}", .{ @errorName(err.err), err.msg }),
else => {},
}