summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-04 22:58:32 +0200
committerGitHub <noreply@github.com>2017-09-04 22:58:32 +0200
commit6960f8a3b848d3569b104f9b02f9fb581fdafc81 (patch)
treefedace224e05d5b932bd2e5cccec43a038baee4f /scene
parentbba365fab709c74dc404509c9f8843ea0841a158 (diff)
parentc1b31aeb942efda33b1ae9617d89d9275e9f6fd6 (diff)
Merge pull request #10916 from volzhs/vertical-align-tree-lineedit
LineEdit in Tree is aligned vertical center
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/tree.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 5e15bceb7d..de17416d8e 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -1116,7 +1116,8 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
cache.selected->draw(ci, r);
}
if (text_editor->is_visible_in_tree()) {
- text_editor->set_position(get_global_position() + r.position);
+ Vector2 ofs(0, (text_editor->get_size().height - r.size.height) / 2);
+ text_editor->set_position(get_global_position() + r.position - ofs);
}
}
@@ -2572,7 +2573,8 @@ bool Tree::edit_selected() {
} else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) {
- Point2i textedpos = get_global_position() + rect.position;
+ Vector2 ofs(0, (text_editor->get_size().height - rect.size.height) / 2);
+ Point2i textedpos = get_global_position() + rect.position - ofs;
text_editor->set_position(textedpos);
text_editor->set_size(rect.size);
text_editor->clear();