Skip to content

Commit 6181a0c

Browse files
committed
Merge pull request #107338 from TelePete/label-ratio-fix
Fix visible ratio when displaying all characters in Label
2 parents 86408d1 + a4ba3d5 commit 6181a0c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scene/gui/label.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,10 +1269,10 @@ String Label::get_text() const {
12691269
void Label::set_visible_characters(int p_amount) {
12701270
if (visible_chars != p_amount) {
12711271
visible_chars = p_amount;
1272-
if (get_total_character_count() > 0) {
1273-
visible_ratio = (float)p_amount / (float)get_total_character_count();
1274-
} else {
1272+
if (p_amount == -1 || get_total_character_count() == 0) {
12751273
visible_ratio = 1.0;
1274+
} else {
1275+
visible_ratio = (float)p_amount / (float)get_total_character_count();
12761276
}
12771277
if (visible_chars_behavior == TextServer::VC_CHARS_BEFORE_SHAPING) {
12781278
text_dirty = true;

0 commit comments

Comments
 (0)