Repository navigation
Add target card - #3
Merged
Merged
Conversation
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.
What
Adds a third card — Target Card — for building a dial-up card for a set of known targets, instead of the even range ladder the trajectory table produces.
+ Add targetappends B, C, D, … (spreadsheet-style, so it continuesZ → AA → AB). The×deletes a row and relabels the rest, and is disabled when only one row is left, enforcing the one-row minimum.Calculate correctionsrenders a table (with the existing mobiletcardfallback) giving per target: drop cm, elevation in MRAD/MOA, elevation clicks to dial UP, drift cm with the side it pushes to, windage in MRAD/MOA, windage clicks with the direction to dial, ToF and remaining velocity.–and is named in a note rather than being estimated.localStoragewith the rest of the state. Once a card is on screen it re-runs automatically when turret settings or the unit/drag/twist toggles change — matching how the trajectory table already behaves.The card reuses the bullet / rifle / atmosphere / wind inputs from the Full Trajectory Calculator and the turret settings from card 1, so its numbers agree with the trajectory table exactly.
Refactor
The solver setup was pulled out of
runTrajectoryintotrajectoryContext(),deriveShot(),solveShots(),turretSettings(),clicksFor(),fmtClicks()andrenderStability(), andrunTrajectorywas rewired onto them — both cards now share one code path rather than duplicating the physics. Existing behaviour is unchanged.Row values round-trip through
localStorageand are rendered viainnerHTML, so they are HTML-escaped into thevalueattribute. Everything else in those templates is numeric solver output.Tests
node test.js→ 38 passed, 0 failed (all 28 original assertions still pass; 10 new cover row labels, click formatting, a single row, order preservation, duplicates, unreachable/missing →null, monotonic elevation, spin drift folded into drift, and crosswind side).Also driven through a stub-DOM harness exercising the real add/type/delete/calculate wiring, confirming relabeling, the persistence round-trip, the one-row minimum, and the error paths.