╭ changed ────────╮ │src/main_wasm.zig│ ╰─────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────╮ │66 try root_ptr.input(key, root_ptr.getFocus()); │ │67 } │ │68 │ │69 -fn onMouseClick(x: usize, y: usize) !void { │ │69 +fn onMouseClick(focus_id: usize) !void { │ │70 const root_ptr = if (root) |*root_value| root_value else return error.NotStarted; │ │71 - const root_focus = root_ptr.getFocus(); │ │72 - var iter = root_focus.children.iterator(); │ │73 - while (iter.next()) |entry| { │ │74 - const child = entry.value_ptr.*; │ │75 - if (!child.focus.focusable) continue; │ │76 - const r = child.rect; │ │77 - if (x >= r.x and y >= r.y and x < r.x + r.size.width and y < r.y + r.size.height) {│ │78 - try root_focus.setFocus(entry.key_ptr.*); │ │79 - break; │ │80 - } │ │81 - } │ │71 + try root_ptr.getFocus().setFocus(focus_id); │ │72 } │ │73 │ │74 fn consoleLog(arg: []const u8) void { │ ╰───────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │116 }; │ │117 } │ │118 │ │129 -export fn _onMouseClick(x: u32, y: u32) void { │ │130 - onMouseClick(x, y) catch |err| { │ │119 +export fn _onMouseClick(focus_id: u32) void { │ │120 + onMouseClick(focus_id) catch |err| { │ │121 var buf: [256]u8 = undefined; │ │122 const str = std.fmt.bufPrint(&buf, "onMouseClick: {}", .{err}) catch unreachable;│ │123 consoleLog(str); │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯