From 17642692c5d7d5d8f08d1cab53c1e52b2f45efd8 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 18 Oct 2024 22:43:48 +0800 Subject: [PATCH] Fix button click detection when `Tree` is rotated --- scene/gui/tree.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 646cd9c70e30..a581c959e706 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -2978,7 +2978,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, int } // Make sure the click is correct. - Point2 click_pos = get_global_mouse_position() - get_global_position(); + const Point2 click_pos = get_local_mouse_position(); if (!get_item_at_position(click_pos)) { pressed_button = -1; cache.click_type = Cache::CLICK_NONE;