diff --git a/src/vxfw/App.zig b/src/vxfw/App.zig index c8088a7e..6d394a9c 100644 --- a/src/vxfw/App.zig +++ b/src/vxfw/App.zig @@ -463,8 +463,8 @@ const MouseHandler = struct { ctx.phase = .capturing; for (hits.items) |item| { var m_local = mouse; - m_local.col = item.local.col; - m_local.row = item.local.row; + m_local.col = @intCast(item.local.col); + m_local.row = @intCast(item.local.row); try item.widget.captureEvent(ctx, .{ .mouse = m_local }); try app.handleCommand(&ctx.cmds); @@ -475,8 +475,8 @@ const MouseHandler = struct { ctx.phase = .at_target; { var m_local = mouse; - m_local.col = target.local.col; - m_local.row = target.local.row; + m_local.col = @intCast(target.local.col); + m_local.row = @intCast(target.local.row); try target.widget.handleEvent(ctx, .{ .mouse = m_local }); try app.handleCommand(&ctx.cmds); @@ -487,8 +487,8 @@ const MouseHandler = struct { ctx.phase = .bubbling; while (hits.pop()) |item| { var m_local = mouse; - m_local.col = item.local.col; - m_local.row = item.local.row; + m_local.col = @intCast(item.local.col); + m_local.row = @intCast(item.local.row); try item.widget.handleEvent(ctx, .{ .mouse = m_local }); try app.handleCommand(&ctx.cmds); diff --git a/src/vxfw/Border.zig b/src/vxfw/Border.zig index 587f958a..94874c3d 100644 --- a/src/vxfw/Border.zig +++ b/src/vxfw/Border.zig @@ -41,6 +41,7 @@ fn typeErasedDrawFn(ptr: *anyopaque, ctx: vxfw.DrawContext) Allocator.Error!vxfw pub fn draw(self: *const Border, ctx: vxfw.DrawContext) Allocator.Error!vxfw.Surface { 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; + // std.debug.panic("{d} {d}\n", .{ max_width.?, max_height.? }); const child_ctx = ctx.withConstraints(ctx.min, .{ .width = max_width, diff --git a/src/vxfw/FlexColumn.zig b/src/vxfw/FlexColumn.zig index 36dcedd1..dc3406f1 100644 --- a/src/vxfw/FlexColumn.zig +++ b/src/vxfw/FlexColumn.zig @@ -57,14 +57,14 @@ pub fn draw(self: *const FlexColumn, ctx: vxfw.DrawContext) Allocator.Error!vxfw // Draw again, but with distributed heights var second_pass_height: u16 = 0; var max_width: u16 = 0; - const remaining_space = ctx.max.height.? - first_pass_height; + const remaining_space = ctx.max.height.? -| first_pass_height; for (self.children, 1..) |child, i| { const inherent_height = size_list[i - 1]; const child_height = if (child.flex == 0) inherent_height else if (i == self.children.len) // If we are the last one, we just get the remainder - ctx.max.height.? - second_pass_height + ctx.max.height.? -| second_pass_height else inherent_height + (remaining_space * child.flex) / total_flex;