Files
quiver-launcher/Services/CatalogReviewRowActionsGamepadLayout.cs
T
Thomas GeorgiadisandCursor 2c85fa0370 feat: update Quiver Launcher to support .NET 10 and enhance UI/UX
- Introduce Android app
- Migrate project files to .NET 10, updating dependencies and workflows.
- Migrate project to Avalonia 12
- Refactor App.axaml to include a ResourceDictionary for theme management.
- Introduce new styles for gamepad navigation and focus rings.
- Implement hosted main view management for better application lifecycle handling.
- Remove deprecated MainWindow.Mods.cs file and related code.
- Update README to reflect changes in project structure and requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-01 20:06:33 +10:00

54 lines
1.8 KiB
C#

namespace QuiverLauncher.Services;
/// <summary>
/// Gamepad motion for catalog-review card actions when they are stacked vertically
/// (mobile). Horizontal desktop strips keep Left/Right navigation in the view.
/// </summary>
public static class CatalogReviewRowActionsGamepadLayout
{
public enum MoveKind
{
Ignore,
Stay,
WithinStrip,
BackToRow,
AdjacentRow,
}
public readonly record struct Move(MoveKind Kind, int NextIndex, NavigationDirection AdjacentDirection);
/// <summary>
/// Left returns to the card. Up/Down walk the stack and leave to the adjacent
/// review row at either end. Right is a no-op (already in the action column).
/// </summary>
public static Move HandleStacked(NavigationDirection direction, int currentIndex, int count)
{
if (count <= 0)
return new Move(MoveKind.Ignore, -1, direction);
var index = currentIndex < 0 ? 0 : (currentIndex >= count ? count - 1 : currentIndex);
if (direction == NavigationDirection.Left)
return new Move(MoveKind.BackToRow, index, direction);
if (direction == NavigationDirection.Right)
return new Move(MoveKind.Stay, index, direction);
if (direction == NavigationDirection.Up)
{
if (index <= 0)
return new Move(MoveKind.AdjacentRow, index, NavigationDirection.Up);
return new Move(MoveKind.WithinStrip, index - 1, direction);
}
if (direction == NavigationDirection.Down)
{
if (index >= count - 1)
return new Move(MoveKind.AdjacentRow, index, NavigationDirection.Down);
return new Move(MoveKind.WithinStrip, index + 1, direction);
}
return new Move(MoveKind.Ignore, index, direction);
}
}