mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
fix Label visible_characters bad precision
This commit is contained in:
parent
7739db3799
commit
3bd44f3cb6
@ -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 New Issue
Block a user