imgui: fix dpad navigation issue on shield tv

Pressing dpad up or down moves the selection 2 lines up or down resp.
Regression due to ca613db70d.
Happens on 1920x1080 screen with 213 dpi.
Relax vertically touching items test.
This commit is contained in:
Flyinghead 2024-10-17 16:04:27 +02:00
parent d4a223656f
commit 894ac54b80
1 changed files with 1 additions and 1 deletions

View File

@ -11661,7 +11661,7 @@ static bool ImGui::NavScoreItem(ImGuiNavItemData* result)
// Compute distance between boxes
// FIXME-NAV: Introducing biases for vertical navigation, needs to be removed.
float dbx = NavScoreItemDistInterval(cand.Min.x, cand.Max.x, curr.Min.x, curr.Max.x);
float dby = cand.Min.y == curr.Max.y || cand.Max.y == curr.Min.y
float dby = ImFabs(cand.Min.y - curr.Max.y) < 1 || ImFabs(cand.Max.y - curr.Min.y) < 1
// Scale down on Y to keep using box-distance for vertically touching items
? NavScoreItemDistInterval(ImLerp(cand.Min.y, cand.Max.y, 0.2f), ImLerp(cand.Min.y, cand.Max.y, 0.8f), ImLerp(curr.Min.y, curr.Max.y, 0.2f), ImLerp(curr.Min.y, curr.Max.y, 0.8f))
: NavScoreItemDistInterval(cand.Min.y, cand.Max.y, curr.Min.y, curr.Max.y);