From 511134f55ff17330da315f9f3da1702366c31921 Mon Sep 17 00:00:00 2001 From: Micky Date: Thu, 1 Sep 2022 19:22:12 +0200 Subject: [PATCH] Fix Label & RichTextLabel's visible_ratio not working --- scene/gui/label.cpp | 4 ++-- scene/gui/rich_text_label.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/gui/label.cpp b/scene/gui/label.cpp index fd174619d5a..d47629b36b1 100644 --- a/scene/gui/label.cpp +++ b/scene/gui/label.cpp @@ -789,10 +789,10 @@ int Label::get_visible_characters() const { void Label::set_visible_ratio(float p_ratio) { if (visible_ratio != p_ratio) { - if (visible_ratio >= 1.0) { + if (p_ratio >= 1.0) { visible_chars = -1; visible_ratio = 1.0; - } else if (visible_ratio < 0.0) { + } else if (p_ratio < 0.0) { visible_chars = 0; visible_ratio = 0.0; } else { diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index c5fe218a155..9b2e40e0508 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -4945,10 +4945,10 @@ void RichTextLabel::set_visible_ratio(float p_ratio) { if (visible_ratio != p_ratio) { _stop_thread(); - if (visible_ratio >= 1.0) { + if (p_ratio >= 1.0) { visible_characters = -1; visible_ratio = 1.0; - } else if (visible_ratio < 0.0) { + } else if (p_ratio < 0.0) { visible_characters = 0; visible_ratio = 0.0; } else {