summaryrefslogtreecommitdiff
path: root/editor/editor_spin_slider.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:41:43 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 21:57:34 +0200
commit0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch)
tree198d4ff7665d89307f6ca2469fa38620a9eb1672 /editor/editor_spin_slider.cpp
parent07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff)
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'editor/editor_spin_slider.cpp')
-rw-r--r--editor/editor_spin_slider.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp
index e19fcfd55c..39e6746797 100644
--- a/editor/editor_spin_slider.cpp
+++ b/editor/editor_spin_slider.cpp
@@ -47,8 +47,9 @@ String EditorSpinSlider::get_text_value() const {
}
void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
- if (read_only)
+ if (read_only) {
return;
+ }
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
@@ -84,8 +85,9 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
}
}
} else if (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN) {
- if (grabber->is_visible())
+ if (grabber->is_visible()) {
call_deferred("update");
+ }
}
}
@@ -169,8 +171,9 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseMotion> mm = p_event;
if (mm.is_valid() && grabbing_grabber) {
- if (mousewheel_over_grabber)
+ if (mousewheel_over_grabber) {
return;
+ }
float grabbing_ofs = (grabber->get_transform().xform(mm->get_position()).x - grabbing_from) / float(grabber_range);
set_as_ratio(grabbing_ratio + grabbing_ofs);
@@ -361,8 +364,9 @@ void EditorSpinSlider::_evaluate_input_text() {
}
Variant v = expr->execute(Array(), nullptr, false);
- if (v.get_type() == Variant::NIL)
+ if (v.get_type() == Variant::NIL) {
return;
+ }
set_value(v);
}
@@ -381,8 +385,9 @@ void EditorSpinSlider::_value_input_closed() {
//focus_exited signal
void EditorSpinSlider::_value_focus_exited() {
// discontinue because the focus_exit was caused by right-click context menu
- if (value_input->get_menu()->is_visible())
+ if (value_input->get_menu()->is_visible()) {
return;
+ }
_evaluate_input_text();
// focus is not on the same element after the vlalue_input was exited