浏览代码

Put cheaper condition first

Co-authored-by: A Thousand Ships <[email protected]>
Bram Buurlage 1 年之前
父节点
当前提交
1cf6b2cc2e
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      scene/gui/text_edit.cpp

+ 2 - 2
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;