fix node_by_point not properly considering window_rel

This commit is contained in:
hippoz 2023-04-25 15:10:48 +03:00
parent 338e3f2d58
commit 802d611650
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED

View file

@ -48,10 +48,8 @@ UINode *node_by_point(UINode *root, double x, double y)
{ {
for (int i = 0; i < root->nodes_count; i++) { for (int i = 0; i < root->nodes_count; i++) {
UINode *node = root->nodes[i]; UINode *node = root->nodes[i];
double local_x = x - node->window_rel_x; if (ui_rect_contains_point(&node->rect, x - node->window_rel_x, y - node->window_rel_y) && !(node->flags & UI_NODE_DISABLED)) {
double local_y = y - node->window_rel_y; return node_by_point(node, x, 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);
} }
} }
return root; return root;