diff options
author | Bram Buurlage <brambuurlage@gmail.com> | 2023-10-12 12:27:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-12 12:27:35 +0200 |
commit | 1cf6b2cc2efcc57baf61db3c0196d9568b3159fb (patch) | |
tree | 5e77f5fc3ad309656d711ca3de86219d8e854a9a /scene/gui/text_edit.cpp | |
parent | a18f4438464c8d06854e32fdaec7967de7505453 (diff) | |
download | redot-engine-1cf6b2cc2efcc57baf61db3c0196d9568b3159fb.tar.gz |
Put cheaper condition first
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Diffstat (limited to 'scene/gui/text_edit.cpp')
-rw-r--r-- | scene/gui/text_edit.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 46e5d07c06..98eff232dd 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -7466,7 +7466,7 @@ void TextEdit::_scroll_up(real_t p_delta, bool p_animate) { if (target_v_scroll <= 0) { target_v_scroll = 0; } - if (Math::abs(target_v_scroll - v_scroll->get_value()) < 1.0 || !p_animate) { + if (!p_animate || Math::abs(target_v_scroll - v_scroll->get_value()) < 1.0) { v_scroll->set_value(target_v_scroll); } else { scrolling = true; @@ -7494,7 +7494,7 @@ void TextEdit::_scroll_down(real_t p_delta, bool p_animate) { if (target_v_scroll > max_v_scroll) { target_v_scroll = max_v_scroll; } - if (Math::abs(target_v_scroll - v_scroll->get_value()) < 1.0 || !p_animate) { + if (!p_animate || Math::abs(target_v_scroll - v_scroll->get_value()) < 1.0) { v_scroll->set_value(target_v_scroll); } else { scrolling = true; |