diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-06-26 09:08:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 09:08:51 +0200 |
commit | 03bfa476363fc67354f3b4fbe02ebc21228d402b (patch) | |
tree | f6147a8e28e1204bb3013f7750c349dc14343739 | |
parent | c9c3db32068680e9a6965c80b76c1151749cee47 (diff) | |
parent | b941931c95305b82b37e2b951c36a3221c30df62 (diff) |
Merge pull request #9384 from toger5/tree_bgcolor_draw_order
tree fix drawing order for header and removed indentation for custom bg colours
-rw-r--r-- | scene/gui/tree.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 12679c7ba8..d8788b4eca 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1032,20 +1032,6 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (!skip && (p_pos.y + label_h - cache.offset.y) > 0) { - if (!p_item->disable_folding && !hide_folding && p_item->childs) { //has childs, draw the guide box - - Ref<Texture> arrow; - - if (p_item->collapsed) { - - arrow = cache.arrow_collapsed; - } else { - arrow = cache.arrow; - } - - arrow->draw(ci, p_pos + p_draw_ofs + Point2i(0, (label_h - arrow->get_height()) / 2) - cache.offset); - } - //draw separation. //if (p_item->get_parent()!=root || !hide_root) @@ -1154,8 +1140,13 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 if (p_item->cells[i].custom_bg_color) { Rect2 r = cell_rect; - r.position.x -= cache.hseparation; - r.size.x += cache.hseparation; + if (i == 0) { + r.position.x = p_draw_ofs.x; + r.size.x = w + ofs; + } else { + r.position.x -= cache.hseparation; + r.size.x += cache.hseparation; + } if (p_item->cells[i].custom_bg_outline) { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y, r.size.x, 1), p_item->cells[i].bg_color); VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(r.position.x, r.position.y + r.size.y - 1, r.size.x, 1), p_item->cells[i].bg_color); @@ -1352,6 +1343,19 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } } + if (!p_item->disable_folding && !hide_folding && p_item->childs) { //has childs, draw the guide box + + Ref<Texture> arrow; + + if (p_item->collapsed) { + + arrow = cache.arrow_collapsed; + } else { + arrow = cache.arrow; + } + + arrow->draw(ci, p_pos + p_draw_ofs + Point2i(0, (label_h - arrow->get_height()) / 2) - cache.offset); + } //separator //get_painter()->draw_fill_rect( Point2i(0,pos.y),Size2i(get_size().width,1),color( COLOR_TREE_GRID) ); |