mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-04-28 13:27:58 +03:00
Implement scroll bar animation in options menu. (#238)
This commit is contained in:
parent
92e3cbea45
commit
a19e434e9b
1 changed files with 6 additions and 0 deletions
|
@ -62,6 +62,7 @@ static int32_t g_firstVisibleRowIndex;
|
|||
static int32_t g_prevSelectedRowIndex;
|
||||
static int32_t g_selectedRowIndex;
|
||||
static double g_rowSelectionTime;
|
||||
static float g_prevOffsetRatio;
|
||||
|
||||
static bool g_leftWasHeld;
|
||||
static bool g_upWasHeld;
|
||||
|
@ -406,6 +407,7 @@ static void ResetSelection()
|
|||
g_selectedRowIndex = 0;
|
||||
g_prevSelectedRowIndex = 0;
|
||||
g_rowSelectionTime = ImGui::GetTime();
|
||||
g_prevOffsetRatio = 0.0f;
|
||||
g_leftWasHeld = false;
|
||||
g_upWasHeld = false;
|
||||
g_rightWasHeld = false;
|
||||
|
@ -1144,7 +1146,11 @@ static void DrawConfigOptions()
|
|||
{
|
||||
float totalHeight = (clipRectMax.y - clipRectMin.y);
|
||||
float heightRatio = float(visibleRowCount) / float(rowCount);
|
||||
|
||||
float offsetRatio = float(g_firstVisibleRowIndex) / float(rowCount);
|
||||
offsetRatio = Lerp(g_prevOffsetRatio, offsetRatio, 1.0f - exp(-16.0f * ImGui::GetIO().DeltaTime));
|
||||
g_prevOffsetRatio = offsetRatio;
|
||||
|
||||
float minY = offsetRatio * totalHeight + clipRectMin.y;
|
||||
|
||||
drawList->AddRectFilled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue