Fix visible ratio when displaying all characters in Label

This commit is contained in:
TelePete
2025-06-09 23:38:38 +02:00
parent 8f87e60307
commit a4ba3d5bed

View File

@ -1269,10 +1269,10 @@ String Label::get_text() const {
void Label::set_visible_characters(int p_amount) {
if (visible_chars != p_amount) {
visible_chars = p_amount;
if (get_total_character_count() > 0) {
visible_ratio = (float)p_amount / (float)get_total_character_count();
} else {
if (p_amount == -1 || get_total_character_count() == 0) {
visible_ratio = 1.0;
} else {
visible_ratio = (float)p_amount / (float)get_total_character_count();
}
if (visible_chars_behavior == TextServer::VC_CHARS_BEFORE_SHAPING) {
text_dirty = true;