Fix Tree's 'scroll_to_item()' not working correctly on some cases

(cherry picked from commit 144a4cc39f)
This commit is contained in:
Michael Alexsander 2020-06-30 18:22:26 -03:00 committed by Rémi Verschelde
parent 9388237e2d
commit 32c154d297
1 changed files with 1 additions and 1 deletions

View File

@ -3587,7 +3587,7 @@ void Tree::scroll_to_item(TreeItem *p_item) {
const Rect2 r = get_item_rect(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); 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) { } 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); v_scroll->set_value(r.position.y + r.size.y + 2 * cache.vseparation - get_size().y);