2.9.5
Fix day cycle
This commit is contained in:
+12
-5
@@ -35,6 +35,7 @@ import { POLLEN_TYPES, COL_DESCRIPTIONS, UTCI_ENVIRONMENTS } from './config.js';
|
||||
import { useAppState } from './hooks/useAppState.js';
|
||||
import { DayTabs } from './components/DayTabs.js';
|
||||
import { computeWhyFeelsLike, computeGlanceSummary } from './compute.js';
|
||||
import { solarElevationDeg } from './physics.js';
|
||||
import { exportDayXls } from './export.js';
|
||||
|
||||
const html = htm.bind(h);
|
||||
@@ -262,13 +263,19 @@ export function UTCIForecast() {
|
||||
// Derived from currentRow and the active day - no side effects.
|
||||
const whyFeelsLike = computeWhyFeelsLike(currentRow ?? null, UTCI_ENVIRONMENTS[utciEnv]);
|
||||
|
||||
// During time-lapse, the scope reads an interpolated row at the simulated
|
||||
// instant instead of the live "now" row. Everything else stays on real now.
|
||||
// Interpolated row at the precise current instant — used for the scope
|
||||
// display even outside playback so there's no jump when play is pressed.
|
||||
const nowRow = interpolateRowAt(hourlyRows, now.getTime());
|
||||
// During time-lapse, advance from simMs; otherwise fall back to nowRow/currentRow.
|
||||
const simRow = (playing && simMs != null) ? interpolateRowAt(hourlyRows, simMs) : null;
|
||||
const scopeRow = simRow || currentRow;
|
||||
const scopeElev = simRow ? simRow.elev : (liveElev ?? currentRow?.elev ?? 0);
|
||||
const scopeRow = simRow || nowRow || currentRow;
|
||||
// Elevation computed continuously from the simulated instant so the sun
|
||||
// starts exactly where liveElev left off (same solarElevationDeg call).
|
||||
const scopeElev = (playing && simMs != null && location?.lat != null)
|
||||
? solarElevationDeg(location.lat, location.lon, new Date(simMs))
|
||||
: (liveElev ?? currentRow?.elev ?? 0);
|
||||
const scopeDt = simRow ? simRow.dt : now;
|
||||
const scopeCat = simRow ? utciCategory(simRow.utciAdj) : currentCat;
|
||||
const scopeCat = scopeRow ? utciCategory(scopeRow.utciAdj) : currentCat;
|
||||
// Synthesize a storm overlay (lightning) when the simulated hour is wet;
|
||||
// outside playback keep the real active event.
|
||||
const scopeEvent = simRow ? ((simRow.precip ?? 0) >= 4 ? { id: 'storm' } : null) : lensEvent;
|
||||
|
||||
Reference in New Issue
Block a user