From b6b2ec7b7738512fa5edffe6b6a84b15e94ed33b Mon Sep 17 00:00:00 2001 From: balint magyar Date: Sun, 1 Oct 2017 20:11:46 +0200 Subject: [PATCH] Fixed center align in LineEdit --- scene/gui/line_edit.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 8ca487f2bd7..ed8eff436c8 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: {