fix(gui): add pixel offsets to scroll events

This commit is contained in:
CJ van den Berg 2026-04-01 10:10:18 +02:00
parent 45db14f894
commit f484ea0b57
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -403,12 +403,12 @@ fn wioLoop() void {
.scroll_vertical => |dy| { .scroll_vertical => |dy| {
const btn_id: u8 = if (dy < 0) 64 else 65; // up / down scroll const btn_id: u8 = if (dy < 0) 64 else 65; // up / down scroll
const cp = pixelToCellPos(mouse_pos); const cp = pixelToCellPos(mouse_pos);
tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, @as(i32, 0), @as(i32, 0) }) catch {}; tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, cp.xoff, cp.yoff }) catch {};
}, },
.scroll_horizontal => |dx| { .scroll_horizontal => |dx| {
const btn_id: u8 = if (dx < 0) 66 else 67; // left / right scroll const btn_id: u8 = if (dx < 0) 66 else 67; // left / right scroll
const cp = pixelToCellPos(mouse_pos); const cp = pixelToCellPos(mouse_pos);
tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, @as(i32, 0), @as(i32, 0) }) catch {}; tui_pid.send(.{ "RDR", "B", @as(u8, 1), btn_id, cp.col, cp.row, cp.xoff, cp.yoff }) catch {};
}, },
.focused => window.enableTextInput(.{}), .focused => window.enableTextInput(.{}),
.unfocused => window.disableTextInput(), .unfocused => window.disableTextInput(),