fix(gamepad): resolve the menu diagonal tie-break horizontally on all clients (G25)
The gamepad-UI navigation resolvers disagreed on which way a perfect 45-degree stick push (|x| == |y|) resolves: the SDL core picked horizontal (`ax >= ay`) while Apple (`abs(x) > abs(y)`) and Android (`abs(Y) >= abs(X)`) picked vertical. Align Apple (`>` -> `>=`) and Android (`>=` -> `>`) to the SDL core so an exact diagonal moves focus the same way on every client (horizontal wins). This is client-local menu navigation only and never reaches the wire. Completes the last deferred G25 sub-part. Verified: Apple `swift build` + full suite (124 pass); Android `:app:compileDebugKotlin`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -241,7 +241,10 @@ private fun resolveDir(s: NavInputState): NavDir? {
|
||||
if (s.hatY >= 0.5f) return NavDir.DOWN
|
||||
if (s.hatX <= -0.5f) return NavDir.LEFT
|
||||
if (s.hatX >= 0.5f) return NavDir.RIGHT
|
||||
return if (abs(s.stickY) >= abs(s.stickX)) {
|
||||
// Horizontal wins an exact |x| == |y| diagonal tie (Y must be strictly greater to take the
|
||||
// vertical branch), matching the SDL core and Apple nav so a perfect 45° push resolves the
|
||||
// same on every client.
|
||||
return if (abs(s.stickY) > abs(s.stickX)) {
|
||||
when {
|
||||
s.stickY <= -STICK_HIGH -> NavDir.UP
|
||||
s.stickY >= STICK_HIGH -> NavDir.DOWN
|
||||
|
||||
Reference in New Issue
Block a user