diff --git a/src/vxfw/Border.zig b/src/vxfw/Border.zig index 587f958a..2804183c 100644 --- a/src/vxfw/Border.zig +++ b/src/vxfw/Border.zig @@ -39,13 +39,15 @@ fn typeErasedDrawFn(ptr: *anyopaque, ctx: vxfw.DrawContext) Allocator.Error!vxfw /// before drawing the child. If the size is unbounded, border will draw the child and then itself /// around the childs size pub fn draw(self: *const Border, ctx: vxfw.DrawContext) Allocator.Error!vxfw.Surface { + const min_width: u16 = ctx.min.width -| 2; + const min_height: u16 = ctx.min.height -| 2; const max_width: ?u16 = if (ctx.max.width) |width| width -| 2 else null; const max_height: ?u16 = if (ctx.max.height) |height| height -| 2 else null; - const child_ctx = ctx.withConstraints(ctx.min, .{ - .width = max_width, - .height = max_height, - }); + const child_ctx = ctx.withConstraints( + .{ .width = min_width, .height = min_height }, + .{ .width = max_width, .height = max_height }, + ); const child = try self.child.draw(child_ctx); const children = try ctx.arena.alloc(vxfw.SubSurface, 1); diff --git a/src/vxfw/FlexColumn.zig b/src/vxfw/FlexColumn.zig index 36dcedd1..d0f2d4ad 100644 --- a/src/vxfw/FlexColumn.zig +++ b/src/vxfw/FlexColumn.zig @@ -70,7 +70,7 @@ pub fn draw(self: *const FlexColumn, ctx: vxfw.DrawContext) Allocator.Error!vxfw // Create a context for the child const child_ctx = ctx.withConstraints( - .{ .width = 0, .height = child_height }, + .{ .width = ctx.min.width, .height = child_height }, .{ .width = ctx.max.width.?, .height = child_height }, ); const surf = try child.widget.draw(child_ctx); diff --git a/src/vxfw/FlexRow.zig b/src/vxfw/FlexRow.zig index 969c0538..59cc1044 100644 --- a/src/vxfw/FlexRow.zig +++ b/src/vxfw/FlexRow.zig @@ -70,7 +70,7 @@ pub fn draw(self: *const FlexRow, ctx: vxfw.DrawContext) Allocator.Error!vxfw.Su // Create a context for the child const child_ctx = ctx.withConstraints( - .{ .width = child_width, .height = 0 }, + .{ .width = child_width, .height = ctx.min.height }, .{ .width = child_width, .height = ctx.max.height.? }, ); const surf = try child.widget.draw(child_ctx);