From c1f6854adaf7c34b49848d401675369a60135cff Mon Sep 17 00:00:00 2001 From: Umang Kalra Date: Wed, 3 Jun 2020 21:37:34 +0530 Subject: [PATCH] Fixes the right and center alignment bug of rich text label (cherry picked from commit b2a32d007d125342efb7a87defcac381afaaa70d) --- scene/gui/rich_text_label.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 82fd8df1549..911cb5a80fd 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -247,6 +247,11 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int & lh = line < l.height_caches.size() ? l.height_caches[line] : 1; \ line_ascent = line < l.ascent_caches.size() ? l.ascent_caches[line] : 1; \ line_descent = line < l.descent_caches.size() ? l.descent_caches[line] : 1; \ + if (p_mode == PROCESS_DRAW) { \ + if (line < l.offset_caches.size()) { \ + wofs = l.offset_caches[line]; \ + } \ + } \ } \ if (p_mode == PROCESS_POINTER && r_click_item && p_click_pos.y >= p_ofs.y + y && p_click_pos.y <= p_ofs.y + y + lh && p_click_pos.x < p_ofs.x + wofs) { \ if (r_outside) *r_outside = true; \