diff options
| author | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 16:52:37 -0300 |
|---|---|---|
| committer | Juan Linietsky <reduzio@gmail.com> | 2015-01-03 16:52:37 -0300 |
| commit | fbdd925d9be1c4c96d05089d7d5a58cd938b002c (patch) | |
| tree | 9f4eb2ae7c61450dffb4a86bb5e82cf66e23d496 /scene/gui/popup_menu.cpp | |
| parent | eb1f978b1c1693018e9a6d353ca914f8e6586b4e (diff) | |
| download | redot-engine-fbdd925d9be1c4c96d05089d7d5a58cd938b002c.tar.gz | |
-Work in progress visual shader editor *DOES NOT WORK YET*
Diffstat (limited to 'scene/gui/popup_menu.cpp')
| -rw-r--r-- | scene/gui/popup_menu.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 0ba3bdb7c6..1fd1d8adc8 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -30,6 +30,7 @@ #include "print_string.h" #include "os/keyboard.h" #include "translation.h" +#include "os/input.h" String PopupMenu::_get_accel_text(uint32_t p_accel) const { @@ -318,6 +319,10 @@ void PopupMenu::_input_event(const InputEvent &p_event) { int over=_get_mouse_over(Point2(b.x,b.y)); + if (invalidated_click) { + invalidated_click=false; + break; + } if (over<0 || items[over].separator || items[over].disabled) break; //non-activable @@ -336,6 +341,13 @@ void PopupMenu::_input_event(const InputEvent &p_event) { case InputEvent::MOUSE_MOTION: { + if (invalidated_click) { + moved+=Vector2(p_event.mouse_motion.relative_x,p_event.mouse_motion.relative_y); + if (moved.length()>4) + invalidated_click=false; + + } + const InputEventMouseMotion &m=p_event.mouse_motion; for(List<Rect2>::Element *E=autohide_areas.front();E;E=E->next()) { @@ -893,12 +905,17 @@ void PopupMenu::_bind_methods() { } + +void PopupMenu::set_invalidate_click_until_motion() { + moved=Vector2(); + invalidated_click=true; +} + PopupMenu::PopupMenu() { idcount=0; mouse_over=-1; - set_focus_mode(FOCUS_ALL); set_as_toplevel(true); |
