diff --git a/src/node.c b/src/node.c index 4f0971b..1969803 100644 --- a/src/node.c +++ b/src/node.c @@ -48,10 +48,8 @@ UINode *node_by_point(UINode *root, double x, double y) { for (int i = 0; i < root->nodes_count; i++) { UINode *node = root->nodes[i]; - double local_x = x - node->window_rel_x; - double local_y = y - node->window_rel_y; - if (ui_rect_contains_point(&node->rect, local_x, local_y) && !(node->flags & UI_NODE_DISABLED)) { - return node_by_point(node, local_x, local_y); + if (ui_rect_contains_point(&node->rect, x - node->window_rel_x, y - node->window_rel_y) && !(node->flags & UI_NODE_DISABLED)) { + return node_by_point(node, x, y); } } return root;