fix: WidgetStack should walk widgets from top to bottom

This commit is contained in:
CJ van den Berg 2024-10-19 15:29:45 +02:00
parent ecc9181894
commit 1ebd0795ba
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -92,7 +92,11 @@ pub fn resize(self: *Self, pos: Widget.Box) void {
}
pub fn walk(self: *Self, walk_ctx: *anyopaque, f: Widget.WalkFn) bool {
for (self.widgets.items) |*w|
const len = self.widgets.items.len;
for (0..len) |i| {
const n = len - i - 1;
const w = &self.widgets.items[n];
if (w.walk(walk_ctx, f)) return true;
}
return false;
}