Skip to content

Commit c200b4f

Browse files
authored
Fix landscape composite moon rendering alignment in photography guide (#19)
* Fix landscape composite moon rendering alignment * Bump mobile version to 1.1.36 and update changelog * Use preview moon offsets directly in photography guide
1 parent 4c9f5dc commit c200b4f

5 files changed

Lines changed: 37 additions & 31 deletions

File tree

apps/mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@eclipse-timer/mobile",
3-
"version": "1.1.35",
3+
"version": "1.1.36",
44
"private": true,
55
"main": "index.js",
66
"scripts": {

apps/mobile/src/utils/photographyGuide.ts

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,9 @@ function buildLandscapeCompositeLayoutFallback(
249249
sunRadius,
250250
travelVector,
251251
});
252-
const moonOffsetX = moonGeometry.moonCenterX - moonGeometryStageSize / 2;
253-
const moonOffsetY = moonGeometry.moonCenterY - moonGeometryStageSize / 2;
254252
moon = {
255-
x: clampedX + moonOffsetX,
256-
y: clampedY + moonOffsetY,
253+
x: clampedX + moonGeometry.moonOffsetX,
254+
y: clampedY + moonGeometry.moonOffsetY,
257255
radius: moonGeometry.moonRadius,
258256
};
259257
}
@@ -473,6 +471,7 @@ export function buildLandscapeCompositeLayout(
473471
frameWidth,
474472
frameHeight,
475473
);
474+
const travelVector = normalizeTravelVector(input.travelVector);
476475
const rawHorizonY = anchorY + (maxSunAltitudeDeg / LANDSCAPE_VERTICAL_FOV_DEG_24MM) * frameHeight;
477476
const horizonY = clampRange(rawHorizonY, 0, frameHeight);
478477

@@ -497,8 +496,6 @@ export function buildLandscapeCompositeLayout(
497496
const rawY = anchorY - (altitudeDeltaDeg / LANDSCAPE_VERTICAL_FOV_DEG_24MM) * frameHeight;
498497
const clampedX = clampRange(rawX, minX, maxX);
499498
const clampedY = clampRange(rawY, minY, maxY);
500-
const clampedDeltaX = clampedX - rawX;
501-
const clampedDeltaY = clampedY - rawY;
502499
const clamped = Math.abs(clampedX - rawX) > 0.01 || Math.abs(clampedY - rawY) > 0.01;
503500

504501
let moon:
@@ -509,30 +506,21 @@ export function buildLandscapeCompositeLayout(
509506
}
510507
| undefined;
511508
if (row.showMoon) {
512-
const moonRadius = bodyAngularRadiusDegToPixels(
513-
sample.moon.angularRadiusDeg,
514-
frameWidth,
515-
frameHeight,
516-
);
517-
const moonAzimuthDeltaDeg = normalizeSignedDeltaDeg(maxSunAzimuthDeg, sample.moon.azimuthDeg);
518-
const moonAltitudeDeltaDeg = sample.moon.altitudeDeg - maxSunAltitudeDeg;
519-
const moonX =
520-
anchorX +
521-
(moonAzimuthDeltaDeg / LANDSCAPE_HORIZONTAL_FOV_DEG_24MM) * frameWidth +
522-
clampedDeltaX;
523-
const moonY =
524-
anchorY -
525-
(moonAltitudeDeltaDeg / LANDSCAPE_VERTICAL_FOV_DEG_24MM) * frameHeight +
526-
clampedDeltaY;
527-
const centerDistance = Math.hypot(moonX - clampedX, moonY - clampedY);
528-
const isOccluding = centerDistance <= sunRadius + moonRadius + 0.25;
529-
if (isOccluding) {
530-
moon = {
531-
x: moonX,
532-
y: moonY,
533-
radius: moonRadius,
534-
};
535-
}
509+
const moonGeometryStageSize = Math.max(64, sunRadius * LANDSCAPE_MOON_GEOMETRY_STAGE_FACTOR);
510+
const moonGeometry = calculatePreviewMoonGeometry({
511+
progress: row.progress,
512+
kindAtLocation: input.kindAtLocation,
513+
magnitude: input.magnitude,
514+
contacts: input.schedule.contacts,
515+
stageSize: moonGeometryStageSize,
516+
sunRadius,
517+
travelVector,
518+
});
519+
moon = {
520+
x: clampedX + moonGeometry.moonOffsetX,
521+
y: clampedY + moonGeometry.moonOffsetY,
522+
radius: moonGeometry.moonRadius,
523+
};
536524
}
537525

538526
return {

apps/mobile/src/utils/previewGeometry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export type PreviewMoonGeometry = {
2323
moonCenterX: number;
2424
moonCenterY: number;
2525
moonOffsetX: number;
26+
moonOffsetY: number;
2627
moonTravelHalfSpan: number;
2728
};
2829

@@ -232,6 +233,7 @@ export function calculatePreviewMoonGeometry(params: {
232233
moonCenterX,
233234
moonCenterY,
234235
moonOffsetX,
236+
moonOffsetY,
235237
moonTravelHalfSpan: sunRadius + moonRadius,
236238
};
237239
}

apps/mobile/tests/photography-guide.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,14 @@ describe("photography guide schedule", () => {
257257
expect(placement.sunRadius).toBeLessThan(4);
258258
expect(placement.sunRadius).toBeGreaterThan(1);
259259
expect(placement.y + placement.sunRadius).toBeLessThanOrEqual(layout.horizonY);
260+
expect(placement.showMoon).toBe(true);
261+
expect(placement.moon).toBeDefined();
262+
if (!placement.moon) continue;
263+
const centerDistance = Math.hypot(
264+
placement.moon.x - placement.x,
265+
placement.moon.y - placement.y,
266+
);
267+
expect(centerDistance).toBeLessThan(placement.sunRadius * 2.5);
260268
}
261269
});
262270
});

documents/reference/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable updates documented under `documents/` are tracked here.
55
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and versions follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.36] — 2026-02-26
9+
10+
### Fixed
11+
- Corrected Photography Guide landscape composite rendering so moon occlusion aligns with shot schedule previews for eclipse phases.
12+
13+
### Changed
14+
- Bumped `apps/mobile/package.json` version from `1.1.35` to `1.1.36`.
15+
816
## [1.0.1] — 2026-02-19
917

1018
### Added

0 commit comments

Comments
 (0)