Fix Label & RichTextLabel's visible_ratio not working

This commit is contained in:
Micky 2022-09-01 19:22:12 +02:00
parent f02134a8c0
commit 511134f55f
2 changed files with 4 additions and 4 deletions

View File

@ -789,10 +789,10 @@ int Label::get_visible_characters() const {
void Label::set_visible_ratio(float p_ratio) { void Label::set_visible_ratio(float p_ratio) {
if (visible_ratio != p_ratio) { if (visible_ratio != p_ratio) {
if (visible_ratio >= 1.0) { if (p_ratio >= 1.0) {
visible_chars = -1; visible_chars = -1;
visible_ratio = 1.0; visible_ratio = 1.0;
} else if (visible_ratio < 0.0) { } else if (p_ratio < 0.0) {
visible_chars = 0; visible_chars = 0;
visible_ratio = 0.0; visible_ratio = 0.0;
} else { } else {

View File

@ -4945,10 +4945,10 @@ void RichTextLabel::set_visible_ratio(float p_ratio) {
if (visible_ratio != p_ratio) { if (visible_ratio != p_ratio) {
_stop_thread(); _stop_thread();
if (visible_ratio >= 1.0) { if (p_ratio >= 1.0) {
visible_characters = -1; visible_characters = -1;
visible_ratio = 1.0; visible_ratio = 1.0;
} else if (visible_ratio < 0.0) { } else if (p_ratio < 0.0) {
visible_characters = 0; visible_characters = 0;
visible_ratio = 0.0; visible_ratio = 0.0;
} else { } else {