From 32c154d297c1bda11a3f7545fe083551fddf78e4 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Tue, 30 Jun 2020 18:22:26 -0300 Subject: [PATCH] Fix Tree's 'scroll_to_item()' not working correctly on some cases (cherry picked from commit 144a4cc39f037b6deba6095a342ede59d1afa8cb) --- 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 976dd4aa7e1..0aca928625b 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3587,7 +3587,7 @@ void Tree::scroll_to_item(TreeItem *p_item) { const Rect2 r = get_item_rect(p_item); - if (r.position.y < v_scroll->get_value()) { + if (r.position.y <= v_scroll->get_value()) { v_scroll->set_value(r.position.y); } else if (r.position.y + r.size.y + 2 * cache.vseparation > v_scroll->get_value() + get_size().y) { v_scroll->set_value(r.position.y + r.size.y + 2 * cache.vseparation - get_size().y);