diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-06-20 21:10:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-20 21:10:10 +0200 |
commit | 5c66771e3ebccdfec55bb94ea521d2f24cb6200a (patch) | |
tree | 80bea3ee8792cb19e719221987faf1a2bf1e88a3 /scene/gui | |
parent | 7b88ac08437d3bd062efcbdd40c215b533032412 (diff) | |
parent | 072e40368e19e0f88ec1fbb61fe463a6fffcca36 (diff) |
Merge pull request #29283 from qarmin/fix_some_always_same_values
Remove always true/false values
Diffstat (limited to 'scene/gui')
-rw-r--r-- | scene/gui/scroll_bar.cpp | 41 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 5 |
2 files changed, 21 insertions, 25 deletions
diff --git a/scene/gui/scroll_bar.cpp b/scene/gui/scroll_bar.cpp index 686d1c96cc..a7c15151ae 100644 --- a/scene/gui/scroll_bar.cpp +++ b/scene/gui/scroll_bar.cpp @@ -439,27 +439,26 @@ double ScrollBar::get_grabber_size() const { } double ScrollBar::get_area_size() const { - - if (orientation == VERTICAL) { - - double area = get_size().height; - area -= get_stylebox("scroll")->get_minimum_size().height; - area -= get_icon("increment")->get_height(); - area -= get_icon("decrement")->get_height(); - area -= get_grabber_min_size(); - return area; - - } else if (orientation == HORIZONTAL) { - - double area = get_size().width; - area -= get_stylebox("scroll")->get_minimum_size().width; - area -= get_icon("increment")->get_width(); - area -= get_icon("decrement")->get_width(); - area -= get_grabber_min_size(); - return area; - } else { - - return 0; + switch (orientation) { + case VERTICAL: { + double area = get_size().height; + area -= get_stylebox("scroll")->get_minimum_size().height; + area -= get_icon("increment")->get_height(); + area -= get_icon("decrement")->get_height(); + area -= get_grabber_min_size(); + return area; + } break; + case HORIZONTAL: { + double area = get_size().width; + area -= get_stylebox("scroll")->get_minimum_size().width; + area -= get_icon("increment")->get_width(); + area -= get_icon("decrement")->get_width(); + area -= get_grabber_min_size(); + return area; + } break; + default: { + return 0.0; + } } } diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 522c1ecb6a..54370d02ba 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3163,10 +3163,7 @@ bool Tree::is_anything_selected() { void Tree::clear() { - if (blocked > 0) { - - ERR_FAIL_COND(blocked > 0); - } + ERR_FAIL_COND(blocked > 0); if (pressing_for_editor) { if (range_drag_enabled) { |