floor the pixels

This commit is contained in:
sjorsdonkers
2025-05-06 12:43:40 +02:00
parent 0dea4c51b7
commit 2b7a7c0054

View File

@@ -57,8 +57,8 @@ fn dispatchMouseEvent(cmd: anytype) !void {
const page = bc.session.currentPage() orelse return; const page = bc.session.currentPage() orelse return;
const mouse_event = Page.MouseEvent{ const mouse_event = Page.MouseEvent{
.x = @intFromFloat(params.x), // Decimal pixel values are not understood by netsurf or out rendered .x = @intFromFloat(@floor(params.x)), // Decimal pixel values are not understood by netsurf or our rendered
.y = @intFromFloat(params.y), // So we convert them once at intake here .y = @intFromFloat(@floor(params.y)), // So we convert them once at intake here. Using floor such that -0.5 becomes -1 and 0.5 becomes 0.
.type = switch (params.type) { .type = switch (params.type) {
.mousePressed => .pressed, .mousePressed => .pressed,
.mouseReleased => .released, .mouseReleased => .released,