From 188d7ee08069fa331ed0e6a0749650fcf3639a41 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 22 Apr 2026 15:54:14 -0500 Subject: [PATCH] Fix swapped perigee/apogee labels in distance scene --- static/js/moonbounce.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/static/js/moonbounce.js b/static/js/moonbounce.js index f19f034..f44799b 100644 --- a/static/js/moonbounce.js +++ b/static/js/moonbounce.js @@ -358,15 +358,18 @@ } ctx.stroke(); - // Perigee/apogee annotations - const periX = xOf(0.5), periY = yOf(dOf(0.5)); - const apoX = xOf(0.0), apoY = yOf(dOf(0.0)); + // Perigee/apogee annotations. dOf = mean - amp*cos(2πφ), so min (perigee) is at φ=0 and φ=1, + // max (apogee) is at φ=0.5. + const periX = xOf(0.25), periY = yOf(dOf(0.25)); + const apoX = xOf(0.5), apoY = yOf(dOf(0.5)); + // Use phase 0 for perigee marker dot (bottom-left), but put label inside panel at phase 0.25 to keep it readable. + const periMarkX = xOf(0), periMarkY = yOf(dOf(0)); ctx.fillStyle = C.green; - ctx.beginPath(); ctx.arc(periX, periY, 4, 0, Math.PI * 2); ctx.fill(); - pill(ctx, 'perigee (closest)', periX, periY - 14, C.green, 'center'); + ctx.beginPath(); ctx.arc(periMarkX, periMarkY, 4, 0, Math.PI * 2); ctx.fill(); + pill(ctx, 'perigee (closest)', periX, periY + 16, C.green, 'center'); ctx.fillStyle = C.orange; ctx.beginPath(); ctx.arc(apoX, apoY, 4, 0, Math.PI * 2); ctx.fill(); - pill(ctx, 'apogee (farthest)', apoX + 8, apoY + 14, C.orange, 'left'); + pill(ctx, 'apogee (farthest)', apoX, apoY - 14, C.orange, 'center'); // Animated cursor const t = (performance.now() - start) / 1000;