diff options
| author | DictyosteliumDiscoideum <159590297+DictyosteliumDiscoideum@users.noreply.github.com> | 2024-02-09 21:01:13 -0700 |
|---|---|---|
| committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2024-08-28 23:24:43 +0300 |
| commit | 1f751516defb2dbd5409102db3715c80f10c5da5 (patch) | |
| tree | 53975bdd823f35bd224252c6785fdd6349028da4 /scene/gui | |
| parent | 40b378e9e2338d84f897f6991cc913a713295785 (diff) | |
| download | redot-engine-1f751516defb2dbd5409102db3715c80f10c5da5.tar.gz | |
Fix RichTextLabel bottom margin for text clipping
Diffstat (limited to 'scene/gui')
| -rw-r--r-- | scene/gui/rich_text_label.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 9bb6130742..0395dffad9 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -817,6 +817,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o } int line_count = 0; + // Bottom margin for text clipping. + float v_limit = theme_cache.normal_style->get_margin(SIDE_BOTTOM); Size2 ctrl_size = get_size(); // Draw text. for (int line = 0; line < l.text_buf->get_line_count(); line++) { @@ -824,7 +826,7 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o off.y += theme_cache.line_separation; } - if (p_ofs.y + off.y >= ctrl_size.height) { + if (p_ofs.y + off.y >= ctrl_size.height - v_limit) { break; } @@ -1890,10 +1892,12 @@ void RichTextLabel::_notification(int p_what) { visible_paragraph_count = 0; visible_line_count = 0; + // Bottom margin for text clipping. + float v_limit = theme_cache.normal_style->get_margin(SIDE_BOTTOM); // New cache draw. Point2 ofs = text_rect.get_position() + Vector2(0, main->lines[from_line].offset.y - vofs); int processed_glyphs = 0; - while (ofs.y < size.height && from_line < to_line) { + while (ofs.y < size.height - v_limit && from_line < to_line) { MutexLock lock(main->lines[from_line].text_buf->get_mutex()); visible_paragraph_count++; |
