Add a BeforeUpdate event for components to handle mouse out events (specifically for equip item slots showing stat differences.) Corrects a bug with stat differences not refreshing on mouse out.

This commit is contained in:
2023-12-08 16:36:51 -06:00
parent 4ab88b3014
commit ae2d1719c8
7 changed files with 43 additions and 14 deletions
+6 -4
View File
@@ -86,6 +86,12 @@ public:
this->hideQty=!show;
}
protected:
virtual inline void BeforeUpdate(Crawler*game)override{
if(!hovered&&runHoverFunctions&&hoverState){
hoverState=false;
onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,this,(ScrollableWindowComponent*)(parentComponent)});
}
}
virtual inline void Update(Crawler*game)override{
MenuIconButton::Update(game);
valid=!itemRef.get().IsBlank();
@@ -110,10 +116,6 @@ protected:
hoverState=true;
onHover(MenuFuncData{*Menu::menus[parentMenu],game,this,(ScrollableWindowComponent*)(parentComponent)});
}
}else
if(runHoverFunctions&&hoverState){
hoverState=false;
onMouseOut(MenuFuncData{*Menu::menus[parentMenu],game,this,(ScrollableWindowComponent*)(parentComponent)});
}
}
virtual inline void Draw(Crawler*game,vf2d parentPos)override{