From 41d1f9b7d64300be0e9c75893f8c2c515b07529b Mon Sep 17 00:00:00 2001 From: Guy Rabiller Date: Fri, 24 Oct 2014 16:33:18 +0200 Subject: [PATCH] - Fix BaseButton "Click on Press" issue. Now a button correctly show its visual "Pressed" status when "Click on Press" is enabled and the button is clicked. --- scene/gui/base_button.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index ac2417d539..7745ce11fc 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -55,6 +55,9 @@ void BaseButton::_input_event(InputEvent p_event) { if (b.pressed) { if (!toggle_mode) { //mouse press attempt + + status.press_attempt=true; + status.pressing_inside=true; pressed(); emit_signal("pressed"); @@ -71,8 +74,15 @@ void BaseButton::_input_event(InputEvent p_event) { } + } else { + + if (status.press_attempt &&status.pressing_inside) { + pressed(); + emit_signal("pressed"); + } + status.press_attempt=false; } - + update(); break; }