Fix controller paging regression in creative menu

Preserve smooth row-by-row scrolling for mouse wheel input, but restore
full-page movement for controller/menu scroll actions in the creative
inventory.

Commit 3093ca3 changed page indexing to support smooth scrolling, which
caused ACTION_MENU_OTHER_STICK_UP/DOWN to advance by one row instead of
one page. Track whether the scroll action originated from the mouse
wheel and only use single-row steps in that case.

Fixes #253
This commit is contained in:
daoge_cmd
2026-03-05 01:38:34 +08:00
parent ef66f6736d
commit 7b35df8714
3 changed files with 28 additions and 3 deletions

View File

@@ -1098,7 +1098,15 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
}
break;
case ACTION_MENU_OTHER_STICK_DOWN:
++m_tabPage[m_curTab];
{
int pageStep = TabSpec::rows;
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
pageStep = 1;
}
#endif
m_tabPage[m_curTab] += pageStep;
if(m_tabPage[m_curTab] >= specs[m_curTab]->getPageCount())
{
m_tabPage[m_curTab] = specs[m_curTab]->getPageCount() - 1;
@@ -1107,9 +1115,18 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
{
switchTab(m_curTab);
}
}
break;
case ACTION_MENU_OTHER_STICK_UP:
--m_tabPage[m_curTab];
{
int pageStep = TabSpec::rows;
#ifdef _WINDOWS64
if (g_KBMInput.WasMouseWheelConsumed())
{
pageStep = 1;
}
#endif
m_tabPage[m_curTab] -= pageStep;
if(m_tabPage[m_curTab] < 0)
{
m_tabPage[m_curTab] = 0;
@@ -1118,6 +1135,7 @@ void IUIScene_CreativeMenu::handleAdditionalKeyPress(int iAction)
{
switchTab(m_curTab);
}
}
break;
}
}