diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-09-03 13:11:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 13:11:41 +0200 |
commit | 331bb5a8c64831d870b70e7d0a201e3c215b5120 (patch) | |
tree | 4f3a38fd94e8771e37f4511be92a882833bf4acd | |
parent | af5bfd138a7f79aa5698a4046214c7af3f70f39d (diff) | |
parent | dcf65433f1fa103b46b67f9ae655b5a591152b51 (diff) |
Merge pull request #31295 from fstiewitz/focus-rect-issue
Fix get_meta error and visual bug when editing scene with keyboard
-rw-r--r-- | scene/gui/tree.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index b7451faad3..2a18436a5e 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1184,23 +1184,22 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 } } - if (p_item->cells[i].selected && select_mode != SELECT_ROW) { - + if (select_mode != SELECT_ROW && (p_item->cells[i].selected || selected_item == p_item)) { Rect2i r(cell_rect.position, cell_rect.size); + if (p_item->cells[i].text.size() > 0) { float icon_width = p_item->cells[i].get_icon_size().width; r.position.x += icon_width; r.size.x -= icon_width; } p_item->set_meta("__focus_rect", Rect2(r.position, r.size)); - if (has_focus()) { - cache.selected_focus->draw(ci, r); - } else { - cache.selected->draw(ci, r); - } - if (text_editor->is_visible_in_tree()) { - Vector2 ofs2(0, (text_editor->get_size().height - r.size.height) / 2); - text_editor->set_position(get_global_position() + r.position - ofs2); + + if (p_item->cells[i].selected) { + if (has_focus()) { + cache.selected_focus->draw(ci, r); + } else { + cache.selected->draw(ci, r); + } } } |