Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/vxfw/Border.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/vxfw/FlexColumn.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/vxfw/FlexRow.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down