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:
commit
d52974ba95
1 changed files with 4 additions and 1 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue