Просмотр исходного кода

[RTL] Fix text selection offset in padded cells.

Pāvels Nadtočajevs 1 неделя назад
Родитель
Сommit
2a5833148d
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      scene/gui/rich_text_label.cpp

+ 2 - 2
scene/gui/rich_text_label.cpp

@@ -1672,7 +1672,7 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
 									}
 									}
 									if (crect.has_point(p_click)) {
 									if (crect.has_point(p_click)) {
 										for (int j = 0; j < (int)frame->lines.size(); j++) {
 										for (int j = 0; j < (int)frame->lines.size(); j++) {
-											_find_click_in_line(frame, j, rect.position + Vector2(frame->padding.position.x, frame->lines[j].offset.y), rect.size.x, 0, p_click, &table_click_frame, &table_click_line, &table_click_item, &table_click_char, true, p_meta);
+											_find_click_in_line(frame, j, rect.position + Vector2(0.0, frame->lines[j].offset.y), rect.size.x, 0, p_click, &table_click_frame, &table_click_line, &table_click_item, &table_click_char, true, p_meta);
 											if (table_click_frame && table_click_item) {
 											if (table_click_frame && table_click_item) {
 												// Save cell detected cell hit data.
 												// Save cell detected cell hit data.
 												table_range = Vector2i(INT32_MAX, 0);
 												table_range = Vector2i(INT32_MAX, 0);
@@ -1698,7 +1698,7 @@ float RichTextLabel::_find_click_in_line(ItemFrame *p_frame, int p_line, const V
 				}
 				}
 			}
 			}
 		}
 		}
-		Rect2 rect = Rect2(p_ofs + off - Vector2(0, TS->shaped_text_get_ascent(rid)) - p_frame->padding.position, TS->shaped_text_get_size(rid) + p_frame->padding.position + p_frame->padding.size);
+		Rect2 rect = Rect2(p_ofs + off - Vector2(0, TS->shaped_text_get_ascent(rid)), TS->shaped_text_get_size(rid) + p_frame->padding.size);
 		if (p_table) {
 		if (p_table) {
 			rect.size.y += theme_cache.table_v_separation;
 			rect.size.y += theme_cache.table_v_separation;
 		}
 		}