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
12 changes: 6 additions & 6 deletions src/vxfw/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/vxfw/Border.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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.? });
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dont know how to revert this :p sorry!


const child_ctx = ctx.withConstraints(ctx.min, .{
.width = max_width,
Expand Down
4 changes: 2 additions & 2 deletions src/vxfw/FlexColumn.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down