diff options
author | Andreas Haas <Hinsbart@users.noreply.github.com> | 2017-10-02 22:26:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-02 22:26:42 +0200 |
commit | cb71a6d6faf2f42b7695e8fdb8f1c23d8b4ab34d (patch) | |
tree | ff2af1f4c7b4621b3a565665ccb25690e492d17c /scene/gui | |
parent | a4cfec4e2152deb5fc3bceb4564ac3f194f50417 (diff) | |
parent | b6b2ec7b7738512fa5edffe6b6a84b15e94ed33b (diff) |
Merge pull request #11754 from magyar123/master
Fixed center align in LineEdit
Diffstat (limited to 'scene/gui')
-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: { |