From 0ee93257e8b6ab275df5eb8decdcdbf8c9adec56 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 2 Jan 2020 09:20:43 +0800 Subject: [PATCH] Fixes Tree item offset when root is hidden Before this fix, one vseparation is counted for a hidden root item. --- scene/gui/tree.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index f9d1b9e49a9..3cf17bd2106 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3426,7 +3426,10 @@ int Tree::get_item_offset(TreeItem *p_item) const { if (it == p_item) return ofs; - ofs += compute_item_height(it) + cache.vseparation; + ofs += compute_item_height(it); + if (it != root || !hide_root) { + ofs += cache.vseparation; + } if (it->children && !it->collapsed) {