Repository navigation
Draw US state borders on the standard map view - #914
Merged
Merged
Conversation
The Map redesign already loads us_states.json and strokes it, but behind a `scale >= 3` zoom gate. That gate hides the layer in exactly the view a US operator sees: with a grid set and no decodes yet, the map auto-frames the operator at scale ~2.9 — a hair under the threshold — so the state lines never appear. Zoom was the wrong measure anyway. The map COVERs its card, so the same `scale` means very different detail in the two projections: the standard map spends ~6.3 px per degree of longitude at zoom 1 (the lower 48 are ~370 px across — their borders read cleanly), while the azimuthal disc squeezes the whole globe into the card at ~2.8 px per degree, where state outlines really are noise. Gate on that density instead, and fade rather than snap so a pinch doesn't pop a whole layer into existence: stateBorderAlpha() ramps 0 -> 1 between 3 and 6 longitude px per degree, fed by EquirectViewport.pxPerLonDegree for the standard map and azimuthalPxPerLonDegree() for the disc. Net effect: state borders are on throughout the standard projection, still off on the azimuthal world view, and the stroke stays a shade under the national borders so the basemap hierarchy holds. Verified on an emulator: state lines visible at the standard map's default zoom (screenshot in the PR). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #914 +/- ##
=========================================
Coverage 41.50% 41.50%
Complexity 252 252
=========================================
Files 280 280
Lines 33973 33986 +13
Branches 4033 4034 +1
=========================================
+ Hits 14100 14106 +6
- Misses 19584 19591 +7
Partials 289 289
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Asked for: "we should draw the US states on the new map."
The redesign already ships
us_states.jsonand strokes it — but behind ascale >= 3zoom gate. That gate hides the layer in exactly the view a US operator gets: with a grid set and no decodes yet, the map auto-frames the operator at scale ~2.9, a hair under the threshold, so the state lines never appear.What changed
Zoom was the wrong thing to gate on. The map COVERs its card, so the same
scalemeans very different detail in the two projections:stateBorderAlpha()ramps 0 → 1 between 3 and 6 px per degree, fed byEquirectViewport.pxPerLonDegree(standard) andazimuthalPxPerLonDegree()(disc). Fading rather than snapping keeps a pinch from popping a whole layer into existence. The stroke stays a shade under the national borders so the basemap hierarchy holds.Thresholds are tuned against the real map card (~1000x1140 px on a 1080p phone), not a full-screen canvas — the unit tests assert against those measured dimensions.
Verification
testDebugUnitTest(full suite) — pass;MapRedesignTestgains 5 tests covering the ramp, its monotonicity, and both projections at their default views.Not yet checked on real hardware — no phone was attached to this machine.
Follow-up (not in this PR)
UsStateLabels(two-letter abbreviations at state centroids) is already parsed and used by the QSO-sheet mini-map; dropping those onto this map at high zoom would be a small follow-up if you want them.🤖 Generated with Claude Code
https://claude.ai/code/session_01Lbd9brnZDMCzipgsu9n8Xg