diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-23 18:20:39 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-23 18:20:39 -0300 |
commit | 9e0b6057e74181635bf3732879313d3d82bcfd93 (patch) | |
tree | 05a68650c38185aafb60f8f3fe9e520aa7b485b7 | |
parent | a8f8f52b195f1992ae72e5ea21eb0d4eeaeeaa02 (diff) |
Make button aware of it being dragged and reset state, closes #4178
-rw-r--r-- | scene/gui/base_button.cpp | 10 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/scene/gui/base_button.cpp b/scene/gui/base_button.cpp index bc498f47bc..d7632b14b8 100644 --- a/scene/gui/base_button.cpp +++ b/scene/gui/base_button.cpp @@ -225,11 +225,21 @@ void BaseButton::_notification(int p_what) { status.hovering=false; update(); } + if (p_what==NOTIFICATION_DRAG_BEGIN) { + + if (status.press_attempt) { + status.press_attempt=false; + status.pressing_button=0; + update(); + } + } + if (p_what==NOTIFICATION_FOCUS_EXIT) { if (status.pressing_button && status.press_attempt) { status.press_attempt=false; status.pressing_button=0; + update(); } } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index a1df7062ea..3c52af1c1e 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1933,7 +1933,6 @@ void Viewport::_gui_input_event(InputEvent p_event) { } - if (over!=gui.mouse_over) { if (gui.mouse_over) |