diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:28 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-18 09:23:28 -0600 |
commit | d72112ba0a31925ceaaad8156969acb030fe3fd4 (patch) | |
tree | bccb79a082b5100fce958fe6552e5478be6d7d6b /scene/gui | |
parent | 973f16aef1d2c4782ae2de19e492aaf33b6194a0 (diff) | |
parent | d692b7bddeaacf93a06a08a516d8b61cf58085ce (diff) | |
download | redot-engine-d72112ba0a31925ceaaad8156969acb030fe3fd4.tar.gz |
Merge pull request #98816 from arkology/to-infinity-and-beyond
Improve `TextureProgressBar.set_radial_initial_angle()` by removing loops
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/texture_progress_bar.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scene/gui/texture_progress_bar.cpp b/scene/gui/texture_progress_bar.cpp index 4ad56d21d3..24c68e0188 100644 --- a/scene/gui/texture_progress_bar.cpp +++ b/scene/gui/texture_progress_bar.cpp @@ -608,11 +608,10 @@ int TextureProgressBar::get_fill_mode() { } void TextureProgressBar::set_radial_initial_angle(float p_angle) { - while (p_angle > 360) { - p_angle -= 360; - } - while (p_angle < 0) { - p_angle += 360; + ERR_FAIL_COND_MSG(!Math::is_finite(p_angle), "Angle is non-finite."); + + if (p_angle < 0.0 || p_angle > 360.0) { + p_angle = Math::fposmodp(p_angle, 360.0f); } if (rad_init_angle == p_angle) { |