Skip to content

feat(aircraft): hover-select, follow-on-select, richer sidebar, stable list, configurable area/refresh#394

Merged
Kohei-Wada merged 4 commits into
mainfrom
feat/aircraft-hover-richer
May 30, 2026
Merged

feat(aircraft): hover-select, follow-on-select, richer sidebar, stable list, configurable area/refresh#394
Kohei-Wada merged 4 commits into
mainfrom
feat/aircraft-hover-richer

Conversation

@Kohei-Wada
Copy link
Copy Markdown
Owner

Builds on the OpenSky auth work (#393) with a batch of aircraft UX, plus one reusable engine primitive.

New primitive

  • map:project(lon, lat) -> col, row | nil (MapApi::project) — exposes the world→terminal-cell projection so plugins can hit-test the mouse cursor against their own markers in screen space. Unit-tested.

Aircraft

  • Follow-on-select (the headline): changing the selection — keyboard C-n/C-p, Enter, or hover — now anim.fly_tos the selected aircraft, so the map follows the list like the wiki plugin. Previously only Enter moved the map.
  • Hover-select: moving the mouse onto (~2 cells of) a marker selects that aircraft. Movement-gated (keyboard selection still works while the mouse is parked) and pan-stable (compares projected cells, not lon/lat).
  • Stable list + pinned selection: the sidebar is sorted by icao24 so rows keep their place across refreshes instead of reshuffling every fetch, and the selection is re-pinned to the same physical plane (by icao) after each refresh rather than a bare index.
  • Richer sidebar: shows ground speed (km/h) and climb/descent (↑/↓) alongside altitude; also parses origin_country / squawk.
  • Auth-aware refresh: opensky.interval_sec() = 5 s authenticated (matches OpenSky's 5 s resolution) / 12 s anonymous, overridable via ttymap.aircraft.interval_sec.
  • Configurable fetch area: ttymap.aircraft.bbox_half_deg (default 5° → 10°×10°) — the bbox, not max_count, is what bounds how many aircraft are returned; widen it (at higher credit cost) to see more.

Verification

  • luac -p on all touched Lua; unit test for map:project (on-screen → cell, off-canvas → nil).
  • cargo test (full workspace), clippy --all-targets, fmt --check pass.
  • Not exercised in CI: the live interactive behaviour (hover, fly, OpenSky round-trip) — needs a real TTY + credentials; verified manually against a live OpenSky account.

Follow-ups (not in this PR)

  • Country flags in the sidebar (needs a name→ISO2 table; terminal flag-emoji rendering varies).
  • Possibly restrict hover to highlight-only if follow-on-hover proves too aggressive.

…-on-select

- map:project(lon,lat)->col,row|nil MapApi primitive (screen-space hit-test)
- hover-select: mouse onto a marker selects it (movement-gated, pan-stable)
- richer sidebar: ground speed (km/h) + climb/descent (↑/↓); parse country/squawk
- auth-aware interval: 5s authed / 12s anon, ttymap.aircraft.interval_sec override
- fly-on-select: selection change (keyboard + hover) centres the map (wiki-style)
Sort the display list by icao24 so rows keep their place between
fetches instead of reshuffling, and re-pin the selection to the same
physical plane (by icao) after each refresh rather than a bare index.
The ±5° bounding box, not max_count, is what bounds how many aircraft
are returned. Make the half-side configurable so a wider area can be
queried (at higher credit cost).
Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR successfully implements hover-select, follow-on-select, stable list sorting, richer sidebar displays, and configurable refresh intervals for the aircraft plugin. The code quality is high with comprehensive unit tests covering the new map:project() API and proper error handling throughout.

Key Changes Verified:

  • New map:project() primitive correctly projects world coordinates to terminal cells with proper bounds checking
  • Hover-select uses Chebyshev distance for hit detection with movement gating to avoid conflicts with keyboard navigation
  • Stable list sorting by icao24 prevents UI churn across refreshes
  • Selection pinning ensures the highlighted aircraft stays consistent after data refreshes
  • Auth-aware refresh intervals (5s authenticated, 12s anonymous) with configuration override support
  • Enhanced sidebar displays velocity (km/h), vertical rate (↑/↓), and maintains ground state indicators

Testing:

  • Unit tests verify map:project() correctly handles on-screen and off-canvas coordinates
  • All existing tests pass (cargo test, clippy, fmt)
  • Manual verification confirmed with live OpenSky account (as noted in PR description)

The implementation is merge-ready with no blocking defects identified.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.

Flying the view on every mouse movement was disorienting. Hover now
just highlights + pins the selection; keyboard nav / Enter still
centre the map.
@Kohei-Wada Kohei-Wada merged commit 104e0f5 into main May 30, 2026
4 checks passed
@Kohei-Wada Kohei-Wada deleted the feat/aircraft-hover-richer branch May 30, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant