Moon phase fix 2
This commit is contained in:
fraxle
2026-05-27 14:29:01 +01:00
parent 2c0cac5094
commit 6952f0e1c0
2 changed files with 5 additions and 7 deletions
+4 -6
View File
@@ -192,9 +192,8 @@ export function SkyScope({ elev, dt, glob = 0, size = 26 }) {
const phase = moonPhaseFraction(dt);
const moonR = innerR * 0.55;
const phaseOffset = Math.cos(Math.PI * phase) * moonR;
const moonLitFromRight = phase < 0.5;
const shadowCx = r + phaseOffset;
const shadowOffset = (1 - Math.abs(2 * phase - 1)) * 2 * moonR;
const shadowCx = r + (phase < 0.5 ? -shadowOffset : shadowOffset);
const grass = grassFillForElev(elev);
const uid = `ss-${size}-${Math.round(elev * 10)}-${Math.round(phase * 1000)}-${isRising ? 'r' : 's'}`;
@@ -437,9 +436,8 @@ export function ScopeReticle({ value, cat, loading, elev = 0, dt = new Date(), g
const sunGlowPeak = 0.30 + radFrac * 0.45 + horizFrac * 0.15; // centre opacity
const moonDrawR = 15;
const moonY = cy - 45;
const phaseOffset = Math.cos(Math.PI * phase) * moonDrawR;
const moonLitFromRight = phase < 0.5;
const moonShadowCx = cx + phaseOffset;
const shadowOffset = (1 - Math.abs(2 * phase - 1)) * 2 * moonDrawR;
const moonShadowCx = cx + (phase < 0.5 ? -shadowOffset : shadowOffset);
// Readout text colours flip with day/night for legibility against the sky.
const readoutColor = isDay ? '#1e1208' : '#f5edd6';
const readoutMutedColor = isDay ? '#9a7d5a' : '#d4c5a8';