diff options
author | balint magyar <magyarb0201@gmail.com> | 2017-10-01 20:11:46 +0200 |
---|---|---|
committer | balint magyar <magyarb0201@gmail.com> | 2017-10-01 20:11:46 +0200 |
commit | b6b2ec7b7738512fa5edffe6b6a84b15e94ed33b (patch) | |
tree | 8e9827c5c441cf928dc31af576fd8a9d5e5f0203 /scene | |
parent | 99a464ceb4da8558e35d933a30dbaba8025860d8 (diff) |
Fixed center align in LineEdit
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/line_edit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 8ca487f2bd..ed8eff436c 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -601,7 +601,10 @@ void LineEdit::_notification(int p_what) { } break; case ALIGN_CENTER: { - x_ofs = int(size.width - (cached_width)) / 2; + if (window_pos != 0) + x_ofs = style->get_offset().x; + else + x_ofs = int(size.width - (cached_width)) / 2; } break; case ALIGN_RIGHT: { @@ -846,7 +849,10 @@ void LineEdit::set_cursor_at_pixel_pos(int p_x) { } break; case ALIGN_CENTER: { - pixel_ofs = int(size.width - (cached_width)) / 2; + if (window_pos != 0) + pixel_ofs = int(style->get_offset().x); + else + pixel_ofs = int(size.width - (cached_width)) / 2; } break; case ALIGN_RIGHT: { |