@@ -473,6 +473,7 @@ export function buildLandscapeCompositeLayout(
473473 frameWidth ,
474474 frameHeight ,
475475 ) ;
476+ const travelVector = normalizeTravelVector ( input . travelVector ) ;
476477 const rawHorizonY = anchorY + ( maxSunAltitudeDeg / LANDSCAPE_VERTICAL_FOV_DEG_24MM ) * frameHeight ;
477478 const horizonY = clampRange ( rawHorizonY , 0 , frameHeight ) ;
478479
@@ -497,8 +498,6 @@ export function buildLandscapeCompositeLayout(
497498 const rawY = anchorY - ( altitudeDeltaDeg / LANDSCAPE_VERTICAL_FOV_DEG_24MM ) * frameHeight ;
498499 const clampedX = clampRange ( rawX , minX , maxX ) ;
499500 const clampedY = clampRange ( rawY , minY , maxY ) ;
500- const clampedDeltaX = clampedX - rawX ;
501- const clampedDeltaY = clampedY - rawY ;
502501 const clamped = Math . abs ( clampedX - rawX ) > 0.01 || Math . abs ( clampedY - rawY ) > 0.01 ;
503502
504503 let moon :
@@ -509,30 +508,23 @@ export function buildLandscapeCompositeLayout(
509508 }
510509 | undefined ;
511510 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- }
511+ const moonGeometryStageSize = Math . max ( 64 , sunRadius * LANDSCAPE_MOON_GEOMETRY_STAGE_FACTOR ) ;
512+ const moonGeometry = calculatePreviewMoonGeometry ( {
513+ progress : row . progress ,
514+ kindAtLocation : input . kindAtLocation ,
515+ magnitude : input . magnitude ,
516+ contacts : input . schedule . contacts ,
517+ stageSize : moonGeometryStageSize ,
518+ sunRadius,
519+ travelVector,
520+ } ) ;
521+ const moonOffsetX = moonGeometry . moonCenterX - moonGeometryStageSize / 2 ;
522+ const moonOffsetY = moonGeometry . moonCenterY - moonGeometryStageSize / 2 ;
523+ moon = {
524+ x : clampedX + moonOffsetX ,
525+ y : clampedY + moonOffsetY ,
526+ radius : moonGeometry . moonRadius ,
527+ } ;
536528 }
537529
538530 return {
0 commit comments