diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-01-23 12:30:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-23 12:30:23 +0100 |
commit | 51c67a386dd5fdff5b6f1dec3c193c632db390fc (patch) | |
tree | d58d4a0ff7c3543c8e6b10e214eedade521234be | |
parent | 8af0487a0cb2a303c78ebf85eb7e83431159b5e2 (diff) | |
parent | ea211af4125062ddd801c570ca7da21d37beaba6 (diff) |
Merge pull request #25190 from 99alfie/master
Fix ButtonGroup.get_pressed_button bug
-rw-r--r-- | scene/gui/base_button.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index a6b4d475ba..806c8afa5b 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -82,16 +82,16 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce); } - emit_signal("pressed"); _unpress_group(); + emit_signal("pressed"); } else { status.pressed = !status.pressed; pressed(); - emit_signal("pressed"); _unpress_group(); + emit_signal("pressed"); toggled(status.pressed); if (get_script_instance()) { @@ -135,6 +135,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce); } + _unpress_group(); emit_signal("pressed"); } else { @@ -142,6 +143,7 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { status.pressed = !status.pressed; pressed(); + _unpress_group(); emit_signal("pressed"); toggled(status.pressed); @@ -150,8 +152,6 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { } emit_signal("toggled", status.pressed); } - - _unpress_group(); } status.press_attempt = false; @@ -215,12 +215,14 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { get_script_instance()->call(SceneStringNames::get_singleton()->_pressed, NULL, 0, ce); } + _unpress_group(); emit_signal("pressed"); } else { status.pressed = !status.pressed; pressed(); + _unpress_group(); emit_signal("pressed"); toggled(status.pressed); @@ -229,8 +231,6 @@ void BaseButton::_gui_input(Ref<InputEvent> p_event) { } emit_signal("toggled", status.pressed); } - - _unpress_group(); } accept_event(); |