Merge pull request #46776 from jmb462/fix-label-visible_characters_bad_precision

fix Label visible_characters bad precision (Fix #46775)
This commit is contained in:
Rémi Verschelde 2021-03-08 10:30:50 +01:00 committed by GitHub
commit d52974ba95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -260,7 +260,8 @@ void Label::_notification(int p_what) {
}
}
}
visible_glyphs = total_glyphs * percent_visible;
visible_glyphs = MIN(total_glyphs, visible_chars);
}
Vector2 ofs;
@ -541,6 +542,8 @@ void Label::set_visible_characters(int p_amount) {
visible_chars = p_amount;
if (get_total_character_count() > 0) {
percent_visible = (float)p_amount / (float)get_total_character_count();
} else {
percent_visible = 1.0;
}
update();
}