╭ changed ─╮ │src/ui.zig│ ╰──────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────╮ │38 while (try terminal.readKey(io, blocking)) |key| { │ │39 switch (key) { │ │40 .codepoint => |cp| if (cp == 'q') return else try root.input(key, root.getFocus()),│ │41 + .mouse => |mouse| { │ │42 + if (mouse.action == .press and mouse.action.press == .left) { │ │43 + const root_focus = root.getFocus(); │ │44 + var iter = root_focus.children.iterator(); │ │45 + while (iter.next()) |entry| { │ │46 + const child = entry.value_ptr.*; │ │47 + if (!child.focus.focusable) continue; │ │48 + const r = child.rect; │ │49 + if (mouse.x >= r.x and mouse.y >= r.y and │ │50 + mouse.x < r.x + r.size.width and mouse.y < r.y + r.size.height) │ │51 + { │ │52 + try root_focus.setFocus(entry.key_ptr.*); │ │53 + break; │ │54 + } │ │55 + } │ │56 + } else { │ │57 + try root.input(key, root.getFocus()); │ │58 + } │ │59 + }, │ │60 else => try root.input(key, root.getFocus()), │ │61 } │ │62 blocking = false; │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │277 index = @min(index + half_count, children.count() - 1);│ │278 } │ │279 } │ │280 + }, │ │281 + .mouse => |mouse| switch (mouse.action) { │ │282 + .scroll => |dir| switch (dir) { │ │283 + .up => index -|= 1, │ │284 + .down => if (index + 1 < children.count()) { │ │285 + index += 1; │ │286 + }, │ │287 + }, │ │288 + else => {}, │ │289 }, │ │290 else => {}, │ │291 } │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯