From 802d611650d8a1d39c01a7821714e8a7f24f901c Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 25 Apr 2023 15:10:48 +0300 Subject: [PATCH] fix node_by_point not properly considering window_rel --- src/node.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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;