Skip to content

Commit 2c521ea

Browse files
committed
Merge pull request godotengine#101481 from bruvzg/rtl_fade
[RTL] Fix "fade" effect char index calculations.
2 parents 68190ce + c5dc6e1 commit 2c521ea

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scene/gui/rich_text_label.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,8 +1184,8 @@ int RichTextLabel::_draw_line(ItemFrame *p_frame, int p_line, const Vector2 &p_o
11841184
//Apply fx.
11851185
if (fade) {
11861186
float faded_visibility = 1.0f;
1187-
if (glyphs[i].start >= fade->starting_index) {
1188-
faded_visibility -= (float)(glyphs[i].start - fade->starting_index) / (float)fade->length;
1187+
if (l.char_offset + glyphs[i].start >= fade->char_ofs + fade->starting_index) {
1188+
faded_visibility -= (float)((l.char_offset + glyphs[i].start) - (fade->char_ofs + fade->starting_index)) / (float)fade->length;
11891189
faded_visibility = faded_visibility < 0.0f ? 0.0f : faded_visibility;
11901190
}
11911191
font_color.a = faded_visibility;
@@ -5331,10 +5331,10 @@ void RichTextLabel::append_text(const String &p_bbcode) {
53315331
tag_stack.push_front("outline_size");
53325332

53335333
} else if (bbcode_name == "fade") {
5334-
int start_index = brk_pos;
5334+
int start_index = 0;
53355335
OptionMap::Iterator start_option = bbcode_options.find("start");
53365336
if (start_option) {
5337-
start_index += start_option->value.to_int();
5337+
start_index = start_option->value.to_int();
53385338
}
53395339

53405340
int length = 10;

0 commit comments

Comments
 (0)