Merge pull request #31295 from fstiewitz/focus-rect-issue

Fix get_meta error and visual bug when editing scene with keyboard
This commit is contained in:
Rémi Verschelde 2019-09-03 13:11:41 +02:00 committed by GitHub
commit 331bb5a8c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 10 deletions

View File

@ -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);
}
}
}