Honor preview moon travel direction and bump mobile to v1.1.11#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4d5d3d0cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| function normalizeSignedDeltaDeg(fromDeg: number, toDeg: number) { | ||
| const delta = ((toDeg - fromDeg + 540) % 360) - 180; |
There was a problem hiding this comment.
Preserve bearing sweep direction across >180° contacts
determinePreviewTravelDirection currently relies on normalizeSignedDeltaDeg, which forces the C1→C4 bearing delta into [-180, 180]; this flips the sign when the true contact progression spans just over 180° (for example, catalog case 2038-07-02T has increasing bearings from ~90° at C1 to ~270° at C4, while C2/C3 are also increasing, but this normalization yields a negative delta). In those cases the preview gets travelDirection = -1 and animates the moon in the opposite horizontal direction from the chronological contact progression.
Useful? React with 👍 / 👎.
Motivation
Description
PreviewDirectionBearingsand helper functionsnormalizeSignedDeltaDeg,resolveDirectionalBearingPair, anddeterminePreviewTravelDirectioninapps/mobile/src/utils/previewGeometry.tsto derive a signed travel direction (1or-1) from available contact bearings.calculatePreviewMoonGeometryto accept an optionaltravelDirectionparameter and applied it to the computedmoonOffsetXso geometry can flip horizontally when required.c1BearingDeg/c2BearingDeg/c3BearingDeg/c4BearingDeginto thePreviewPayloadinapps/mobile/src/navigation/RootNavigator.tsxand consumed them inEclipsePreviewScreen.tsxby callingdeterminePreviewTravelDirection(...)and adding the result to thecalculatePreviewMoonGeometrycall while updating memo dependencies.apps/mobile/tests/preview-geometry.test.tscovering C1/C2/MAX/C3 tangency behavior, bearing-driven direction flips, and fallback to default direction when bearings are missing, and updatedCHANGELOG.mdandapps/mobile/package.json(bumped to1.1.11).Testing
pnpm -C apps/mobile test tests/preview-geometry.test.tsand all tests passed (5 passed).pnpm -C apps/mobile typecheckand TypeScript checking completed with no errors.Codex Task