mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-26 12:21:39 +00:00
achievement_menu: replicate skills menu fast scrolling
This commit is contained in:
parent
d2e1a475f5
commit
d8082985b1
1 changed files with 4 additions and 24 deletions
|
|
@ -608,7 +608,6 @@ static void DrawContentContainer()
|
|||
auto time = ImGui::GetTime();
|
||||
auto fastScroll = (time - g_lastTappedTime) > 0.6;
|
||||
auto fastScrollSpeed = 1.0 / 3.5;
|
||||
auto fastScrollEncounteredEdge = false;
|
||||
static auto fastScrollSpeedUp = false;
|
||||
|
||||
if (scrollUp || scrollDown)
|
||||
|
|
@ -632,33 +631,24 @@ static void DrawContentContainer()
|
|||
|
||||
scrollUp = upIsHeld;
|
||||
scrollDown = downIsHeld;
|
||||
fastScrollSpeedUp = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (scrollUp)
|
||||
{
|
||||
--g_selectedRowIndex;
|
||||
|
||||
if (g_selectedRowIndex < 0)
|
||||
{
|
||||
g_selectedRowIndex = fastScroll ? 0 : rowCount - 1;
|
||||
fastScrollEncounteredEdge = fastScroll;
|
||||
fastScrollSpeedUp = false;
|
||||
}
|
||||
g_selectedRowIndex = rowCount - 1;
|
||||
}
|
||||
else if (scrollDown)
|
||||
{
|
||||
++g_selectedRowIndex;
|
||||
|
||||
if (g_selectedRowIndex >= rowCount)
|
||||
{
|
||||
g_selectedRowIndex = fastScroll ? rowCount - 1 : 0;
|
||||
fastScrollEncounteredEdge = fastScroll;
|
||||
fastScrollSpeedUp = false;
|
||||
}
|
||||
g_selectedRowIndex = 0;
|
||||
}
|
||||
|
||||
if ((scrollUp || scrollDown) && !fastScrollEncounteredEdge)
|
||||
if (scrollUp || scrollDown)
|
||||
{
|
||||
g_rowSelectionTime = time;
|
||||
Game_PlaySound("sys_actstg_pausecursor");
|
||||
|
|
@ -670,21 +660,11 @@ static void DrawContentContainer()
|
|||
int visibleRowCount = int(floor((clipRectMax.y - clipRectMin.y) / itemHeight));
|
||||
|
||||
if (g_firstVisibleRowIndex > g_selectedRowIndex)
|
||||
{
|
||||
g_firstVisibleRowIndex = g_selectedRowIndex;
|
||||
|
||||
if (g_selectedRowIndex > 0)
|
||||
fastScrollSpeedUp = true;
|
||||
}
|
||||
|
||||
if (g_firstVisibleRowIndex + visibleRowCount - 1 < g_selectedRowIndex)
|
||||
{
|
||||
g_firstVisibleRowIndex = std::max(0, g_selectedRowIndex - visibleRowCount + 1);
|
||||
|
||||
if (g_selectedRowIndex < rowCount - 1)
|
||||
fastScrollSpeedUp = true;
|
||||
}
|
||||
|
||||
// Pop clip rect from DrawContentContainer
|
||||
drawList->PopClipRect();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue