Browse Source

Tree: Fix offset calculation when there are hidden items

Haoyu Qiu 2 years ago
parent
commit
a083c85521
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scene/gui/tree.cpp

+ 2 - 2
scene/gui/tree.cpp

@@ -4594,8 +4594,8 @@ int Tree::get_item_offset(TreeItem *p_item) const {
 			return ofs;
 			return ofs;
 		}
 		}
 
 
-		ofs += compute_item_height(it);
-		if (it != root || !hide_root) {
+		if ((it != root || !hide_root) && it->is_visible()) {
+			ofs += compute_item_height(it);
 			ofs += theme_cache.v_separation;
 			ofs += theme_cache.v_separation;
 		}
 		}