瀏覽代碼

Fixes Tree item offset when root is hidden

Before this fix, one vseparation is counted for a hidden root item.
Haoyu Qiu 5 年之前
父節點
當前提交
0ee93257e8
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      scene/gui/tree.cpp

+ 4 - 1
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) {