diff options
author | Eric M <itsjusteza@gmail.com> | 2020-09-07 22:57:50 +1000 |
---|---|---|
committer | Eric M <itsjusteza@gmail.com> | 2020-11-08 13:28:23 +1000 |
commit | c482e8ec85e75f8900c11ba04213c3e42fd64db6 (patch) | |
tree | 01fbf165015371538e2125f2fcbe9d522f934949 /scene/gui/popup_menu.h | |
parent | 30b6db99a99a94c64d906c1b828ff44f79a1bc75 (diff) | |
download | redot-engine-c482e8ec85e75f8900c11ba04213c3e42fd64db6.tar.gz |
Added hysteresis for popup sub-menus
This adds a small lag effect when opening submenus which allow the user to move directly to an item on the submenu without worrying about avoiding the autohide regions.
Diffstat (limited to 'scene/gui/popup_menu.h')
-rw-r--r-- | scene/gui/popup_menu.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scene/gui/popup_menu.h b/scene/gui/popup_menu.h index e8f82ba869..a2e7d7e6cd 100644 --- a/scene/gui/popup_menu.h +++ b/scene/gui/popup_menu.h @@ -86,6 +86,9 @@ class PopupMenu : public Popup { } }; + bool close_allowed = false; + + Timer *minimum_lifetime_timer = nullptr; Timer *submenu_timer; List<Rect2> autohide_areas; Vector<Item> items; @@ -102,7 +105,7 @@ class PopupMenu : public Popup { void _scroll_to_item(int p_item); void _gui_input(const Ref<InputEvent> &p_event); - void _activate_submenu(int over); + void _activate_submenu(int p_over); void _submenu_timeout(); uint64_t popup_time_msec = 0; @@ -130,6 +133,9 @@ class PopupMenu : public Popup { void _draw_items(); void _draw_background(); + void _minimum_lifetime_timeout(); + void _close_pressed(); + protected: friend class MenuButton; void _notification(int p_what); |