feat(hud): Blue Marble default basemap + constant-speed readable news ticker #67

Merged
sirius merged 1 commit from wt/t_88bfa75f into master 2026-11-20 04:45:54 +00:00

View file

@ -720,7 +720,7 @@
-webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 calc(100% - 26px), transparent 100%);
} }
.tick-track { display: flex; width: max-content; animation: marquee 60s linear infinite; } .tick-track { display: flex; width: max-content; animation: marquee 60s linear infinite; }
.ticker.news .tick-track { animation-duration: 90s; } .ticker.news .tick-track { animation-duration: 240s; } /* fallback; JS sets constant px/s */
.tick-wrap:hover .tick-track, .tick-wrap:focus-within .tick-track { animation-play-state: paused; } .tick-wrap:hover .tick-track, .tick-wrap:focus-within .tick-track { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } } @keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tick-group { display: flex; align-items: center; } .tick-group { display: flex; align-items: center; }
@ -1874,6 +1874,7 @@ function initMarketTicker() {
/* ═══════════════ NEWS FEED + TICKER ═══════════════ */ /* ═══════════════ NEWS FEED + TICKER ═══════════════ */
let newsInterval = null; let newsInterval = null;
const NEWS_REFRESH_MS = 180000; // 3-min ticker/brief poll const NEWS_REFRESH_MS = 180000; // 3-min ticker/brief poll
const NEWS_TICKER_PX_PER_S = 28; // constant readable scroll speed for the news ticker
let newsTickerBuilt = false; let newsTickerBuilt = false;
function newsEsc(s) { function newsEsc(s) {
@ -2016,6 +2017,13 @@ function renderNewsTicker(articles, summaries, tickerItems) {
items = `<span class="tick-item standby">No headlines yet — scraper idle</span>`; items = `<span class="tick-item standby">No headlines yet — scraper idle</span>`;
} }
track.innerHTML = `<span class="tick-group">${items}</span><span class="tick-group">${items}</span>`; track.innerHTML = `<span class="tick-group">${items}</span><span class="tick-group">${items}</span>`;
// Constant pixel speed regardless of headline count: the marquee travels
// one group width (track = two identical copies, keyframe goes to -50%).
// Recomputed on every rebuild; market ticker keeps its own CSS duration.
const groupWidth = track.scrollWidth / 2;
track.style.animationDuration = groupWidth > 0
? `${(groupWidth / NEWS_TICKER_PX_PER_S).toFixed(2)}s`
: '';
newsTickerBuilt = true; newsTickerBuilt = true;
} }
@ -2539,10 +2547,12 @@ async function initMap() {
const sel = document.getElementById('map-layer'); const sel = document.getElementById('map-layer');
sel.innerHTML = mapLayers.map(l => sel.innerHTML = mapLayers.map(l =>
`<option value="${l.id}">${l.title}</option>`).join(''); `<option value="${l.id}">${l.title}</option>`).join('');
// Blue Marble first: static, gap-free basemap. Satellite true-color
// (VIIRS/MODIS) has cloud/coverage gaps — still selectable below.
const preferred = const preferred =
mapLayers.find(l => l.id === 'VIIRS_SNPP_CorrectedReflectance_TrueColor') mapLayers.find(l => l.id === 'BlueMarble_ShadedRelief_Bathymetry')
|| mapLayers.find(l => l.id === 'VIIRS_SNPP_CorrectedReflectance_TrueColor')
|| mapLayers.find(l => l.id === 'MODIS_Terra_CorrectedReflectance_TrueColor') || mapLayers.find(l => l.id === 'MODIS_Terra_CorrectedReflectance_TrueColor')
|| mapLayers.find(l => l.id === 'BlueMarble_ShadedRelief_Bathymetry')
|| mapLayers.find(l => !l.has_time) || mapLayers.find(l => !l.has_time)
|| mapLayers[0]; || mapLayers[0];
if (preferred) sel.value = preferred.id; if (preferred) sel.value = preferred.id;