Kaynağa Gözat

Merge pull request #39164 from theoway/richlabeltext_align_bug

Fixes the right and center alignment bug of rich text label
Rémi Verschelde 5 yıl önce
ebeveyn
işleme
7c3dc855ca
1 değiştirilmiş dosya ile 5 ekleme ve 0 silme
  1. 5 0
      scene/gui/rich_text_label.cpp

+ 5 - 0
scene/gui/rich_text_label.cpp

@@ -256,6 +256,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)                                                                                                                                      \