Skip to content

Commit 1d6707b

Browse files
committed
Merge pull request #103705 from BrotherShort/rtl_SceneTree_item_rename
Fix SceneTree's rename LineEdit's offset position
2 parents cbb1e0e + 7d7b773 commit 1d6707b

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

scene/gui/tree.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,13 +4107,18 @@ bool Tree::edit_selected(bool p_force_edit) {
41074107
// "floor()" centers vertically.
41084108
Vector2 ofs(0, Math::floor((MAX(line_editor->get_minimum_size().height, rect.size.height - value_editor_height) - rect.size.height) / 2));
41094109

4110-
popup_rect.position = get_screen_position() + rect.position - ofs;
4111-
popup_rect.size = rect.size;
4112-
41134110
// Account for icon.
41144111
Size2 icon_size = _get_cell_icon_size(c) * popup_scale;
4115-
popup_rect.position.x += icon_size.x;
4116-
popup_rect.size.x -= icon_size.x;
4112+
4113+
popup_rect.size = rect.size;
4114+
popup_rect.size.x -= icon_size.x + theme_cache.h_separation;
4115+
4116+
popup_rect.position = rect.position - ofs;
4117+
popup_rect.position.x += icon_size.x + theme_cache.h_separation;
4118+
if (cache.rtl) {
4119+
popup_rect.position.x = get_size().width - popup_rect.position.x - popup_rect.size.x;
4120+
}
4121+
popup_rect.position += get_screen_position();
41174122

41184123
line_editor->clear();
41194124
line_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::range_step_decimals(c.step)));

0 commit comments

Comments
 (0)