╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2012 }, │ │2013 .mouse => |mouse| { │ │2014 if (mouse.action == .press and mouse.action.press == .left) { │ │2015 - var clicked: ?usize = null; │ │2016 - var iter = root_focus.children.iterator(); │ │2017 - while (iter.next()) |entry| { │ │2018 - const child = entry.value_ptr.*; │ │2019 - if (!child.focus.focusable and !widget.isBackButton(child.focus)) continue; │ │2020 - const r = child.rect; │ │2021 - if (mouse.x >= r.x and mouse.y >= r.y and │ │2022 - mouse.x < r.x + r.size.width and mouse.y < r.y + r.size.height) │ │2023 - { │ │2024 - clicked = entry.key_ptr.*; │ │2025 - break; │ │2015 + if (root_focus.hitTest(mouse.x, mouse.y)) |hit| { │ │2016 + const focus_id = hit.id; │ │2017 + if (hit.kind == .background) { │ │2018 + root_focus.setFocus(focus_id); │ │2019 + return; │ │2020 } │ │2027 - } │ │2028 - if (clicked) |focus_id| { │ │2021 if (widget.isBackButton((root_focus.children.get(focus_id) orelse return).focus)) {│ │2022 if (session.back == .available) session.back = .requested; │ │2023 return; │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │2174 }; │ │2175 var tb = try wgt.TextBox.init(allocator, text, .{ .border_style = .single, .rounded_corners = true, .wrap_kind = .none, .label = " author " });│ │2176 errdefer tb.deinit(allocator); │ │2185 - tb.getFocus().focusable = true; │ │2177 + tb.getFocus().mode = .all; │ │2178 switch (author) { │ │2179 .user_name => |name| tb.getFocus().kind = .{ .custom = try userLink(page_arena, name) }, │ │2180 else => {}, │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯