diff --git a/src/map.ts b/src/map.ts index 6b3f3fe..81f2914 100644 --- a/src/map.ts +++ b/src/map.ts @@ -54,7 +54,7 @@ const LOCATIONS: Record = { blurb: 'Marknad, dofter från femtio kök samtidigt, musik från tre högtalare som aldrig riktigt spelar samma låt.', }, universitet: { - lat: 55.5721, lng: 12.9998, label: 'Malmö universitet', + lat: 55.6083, lng: 12.9974, label: 'Malmö universitet', blurb: 'Bibliotek och föreläsningssalar. Ett rum för sällan efterfrågade samlingar som er kod alltid fungerar till.', }, }; diff --git a/src/ui.ts b/src/ui.ts index cf3b985..98270ed 100644 --- a/src/ui.ts +++ b/src/ui.ts @@ -424,22 +424,32 @@ function renderLog(state: State): void { // state.log is newest-first (unshift). The newest line gets its own // element so it can type itself out; everything else renders plainly. + // It has to come FIRST in the DOM to match scrollTop = 0 below — it + // previously came last, which put the newest entry below the fold, + // scrolled out of view until enough later entries pushed it up. const [newest, ...rest] = state.log; - log.innerHTML = rest.map(e => `
${e.text}
`).join('') - + (newest ? `
` : ''); + log.innerHTML = (newest ? `
` : '') + + rest.map(e => `
${e.text}
`).join(''); log.scrollTop = 0; if (typewriterTimer !== undefined) { window.clearInterval(typewriterTimer); typewriterTimer = undefined; } if (newest) { const el = document.getElementById('log-newest')!; - if (isFirstRender || state.phase !== 'playing') { - // Don't animate the save you just loaded, or the ending screen's line. + // Only narrative beats (story events, kaos) get the typewriter — the + // player's own actions (upgrades, visits) confirm instantly. Animating + // those too made the log feel like it was lagging a full action behind: + // the reveal took 1-2s, and if you acted again before it finished, the + // old line would silently snap to full text right as the new one + // started typing, which read exactly like "nothing happened until the + // next event." + const animate = !isFirstRender && state.phase === 'playing' && (newest.kind === 'event' || newest.kind === 'kaos'); + if (!animate) { el.textContent = newest.text; } else { const dreadIntensity = Math.min(1, state.dread / 150); const text = newest.text; - const stepMs = text.length > 120 ? 8 : 18; + const stepMs = text.length > 90 ? 4 : 8; let i = 0; typewriterTimer = window.setInterval(() => { i += 1;