From b05aab4b330a72001936d7a09b9a86303ff1a4bd Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Wed, 16 Oct 2024 05:07:46 -0600 Subject: [PATCH] Fix selecting root node before button released In order to test if the button press is within the scene tree, the Tree's coordinates should be used, not the SceneTreeEditor's. --- editor/scene_tree_dock.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index bcab0c2883c..9ae72498d4b 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -126,7 +126,8 @@ void SceneTreeDock::input(const Ref &p_event) { Ref mb = p_event; if (mb.is_valid() && (mb->get_button_index() == MouseButton::LEFT || mb->get_button_index() == MouseButton::RIGHT)) { - if (mb->is_pressed() && scene_tree->get_rect().has_point(scene_tree->get_local_mouse_position())) { + Tree *tree = scene_tree->get_scene_tree(); + if (mb->is_pressed() && tree->get_rect().has_point(tree->get_local_mouse_position())) { tree_clicked = true; } else if (!mb->is_pressed()) { tree_clicked = false;