fix: fix mouse and controller input handling in container menus

This commit is contained in:
daoge_cmd
2026-03-03 04:59:08 +08:00
parent f917335b13
commit 8f6647b5d8
3 changed files with 13 additions and 7 deletions

View File

@@ -21,6 +21,7 @@ IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu()
m_pointerPos.x = 0.0f;
m_pointerPos.y = 0.0f;
m_bPointerDrivenByMouse = false;
}
@@ -357,6 +358,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// If there is any input on sticks, move the pointer.
if ( ( fabs( fInputX ) >= 0.01f ) || ( fabs( fInputY ) >= 0.01f ) )
{
m_bPointerDrivenByMouse = false;
fInputDirX = ( fInputX > 0.0f ) ? 1.0f : ( fInputX < 0.0f )?-1.0f : 0.0f;
fInputDirY = ( fInputY > 0.0f ) ? 1.0f : ( fInputY < 0.0f )?-1.0f : 0.0f;
@@ -692,7 +694,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// If there is no stick input, and we are over a slot, then snap pointer to slot centre.
// 4J - TomK - only if this particular component allows so!
if(CanHaveFocus(eSectionUnderPointer))
if(!m_bPointerDrivenByMouse && CanHaveFocus(eSectionUnderPointer))
{
vPointerPos.x = vSnapPos.x;
vPointerPos.y = vSnapPos.y;