Fix menu hovering causing selection on menus to be messed up in mouse navigation mode.
This commit is contained in:
parent
4aaa954d05
commit
3ff1ff0b04
@ -203,6 +203,7 @@ void Menu::Update(AiL*game){
|
||||
}
|
||||
}
|
||||
}else{
|
||||
selection={};
|
||||
for(auto&[key,component]:components){
|
||||
if(component->selectable){
|
||||
if(!component->disabled&&!component->grayedOut){
|
||||
@ -321,33 +322,35 @@ void Menu::SetDefaultButton(std::weak_ptr<MenuComponent>button){
|
||||
void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
|
||||
std::weak_ptr<MenuComponent>prevSelection=selection;
|
||||
|
||||
std::string selectionButtonName=selection.lock()->GetName();
|
||||
if(navigationGroups.count(selectionButtonName)){
|
||||
Navigation nav=navigationGroups[selectionButtonName];
|
||||
if(!selection.expired()){
|
||||
std::string selectionButtonName=selection.lock()->GetName();
|
||||
if(navigationGroups.count(selectionButtonName)){
|
||||
Navigation nav=navigationGroups[selectionButtonName];
|
||||
|
||||
if(game->KEY_UP.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.up)&&std::get<std::string>(nav.up).length()>0)selection=components[std::get<std::string>(nav.up)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.up))std::get<MenuDataFunc>(nav.up)(type);
|
||||
}
|
||||
if(game->KEY_DOWN.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.down)&&std::get<std::string>(nav.down).length()>0)selection=components[std::get<std::string>(nav.down)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.down))std::get<MenuDataFunc>(nav.down)(type);
|
||||
}
|
||||
if(game->KEY_LEFT.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.left)&&std::get<std::string>(nav.left).length()>0)selection=components[std::get<std::string>(nav.left)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.left))std::get<MenuDataFunc>(nav.left)(type);
|
||||
}
|
||||
if(game->KEY_RIGHT.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.right)&&std::get<std::string>(nav.right).length()>0)selection=components[std::get<std::string>(nav.right)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.right))std::get<MenuDataFunc>(nav.right)(type);
|
||||
if(game->KEY_UP.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.up)&&std::get<std::string>(nav.up).length()>0)selection=components[std::get<std::string>(nav.up)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.up))std::get<MenuDataFunc>(nav.up)(type);
|
||||
}
|
||||
if(game->KEY_DOWN.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.down)&&std::get<std::string>(nav.down).length()>0)selection=components[std::get<std::string>(nav.down)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.down))std::get<MenuDataFunc>(nav.down)(type);
|
||||
}
|
||||
if(game->KEY_LEFT.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.left)&&std::get<std::string>(nav.left).length()>0)selection=components[std::get<std::string>(nav.left)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.left))std::get<MenuDataFunc>(nav.left)(type);
|
||||
}
|
||||
if(game->KEY_RIGHT.Pressed()){
|
||||
SetMouseNavigation(false);
|
||||
if(std::holds_alternative<std::string>(nav.right)&&std::get<std::string>(nav.right).length()>0)selection=components[std::get<std::string>(nav.right)];
|
||||
else
|
||||
if(std::holds_alternative<MenuDataFunc>(nav.right))std::get<MenuDataFunc>(nav.right)(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,6 @@ public:
|
||||
}else{
|
||||
component->depth=depth;
|
||||
}
|
||||
RecalculateComponentCount();
|
||||
|
||||
if(components.count(componentKey)){
|
||||
ERR("WARNING! Key "<<componentKey<<" for this sub-menu already exists! Key names must be unique!")
|
||||
@ -174,6 +173,8 @@ public:
|
||||
components.SetInitialized();
|
||||
lastRegisteredComponent=componentKey;
|
||||
|
||||
RecalculateComponentCount();
|
||||
|
||||
return component;
|
||||
}
|
||||
void Update(AiL*game);
|
||||
|
@ -74,6 +74,7 @@ class MenuComponent:public IAttributable{
|
||||
friend class MenuItemButton;
|
||||
friend class ScrollableWindowComponent;
|
||||
friend class InventoryScrollableWindowComponent;
|
||||
friend class EncountersSpawnListScrollableWindowComponent;
|
||||
friend class MenuItemItemButton;
|
||||
friend class RowItemDisplay;
|
||||
MenuType menuDest;
|
||||
|
@ -11,6 +11,8 @@ Settings Menu
|
||||
remove that bind from the list. Up to two keys may be binded per action.
|
||||
-We have to save keybinds to the save file.
|
||||
|
||||
- Fix Stage Completed screen, item displays can hit the scrollbar.
|
||||
|
||||
January 31st
|
||||
============
|
||||
Make new unlocked nodes more obvious, made neighboring nodes more obvious
|
||||
@ -28,10 +30,9 @@ Story proofreading/correcting/storyboarding
|
||||
- Lock up unimplemented classes.
|
||||
- Don't enable all stage plates normally.
|
||||
|
||||
- Hide mouse cursor during controller play. Reveal it again during mouse play.
|
||||
|
||||
|
||||
- Emscripten _DEBUG flag add as an option when building
|
||||
|
||||
|
||||
mainMenuWindow->SetupKeyboardNavigation(
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 5969
|
||||
#define VERSION_BUILD 5974
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user