/* ============================================================================= * B06_Section_UI_Section_View_Lazy.ts * 횡단 카드 목록 통째 그리기에서 **보이는 카드 먼저**(PLAN 346-2 4파 · 측점 수가 바뀌어 목록을 다시 짤 때) — * 보이는 줄 + 한 줄만 바로 그리고 나머지는 같은 id · 같은 높이 빈 자리로 두었다가 쉬는 틈에 진짜 카드로 * (`createIdleQueue` · 화면 밖 카드 갈아 끼우기와 같은 줄). 스크롤 자리 · 측점 찾기는 빈 자리로도 그대로. * ========================================================================== */ /** 처음에 바로 그릴 카드 수 — 보이는 줄 + 한 줄 · 칸이 아직 안 보이면(높이 0) 두 줄. */ export function eagerCardCount( view: { clientHeight: number; scrollTop: number }, cols: number, rowHeightPx: number, gapPx: number, ): number { const rows = view.clientHeight > 0 ? Math.ceil((view.scrollTop + view.clientHeight) / Math.max(rowHeightPx + gapPx, 1)) + 1 : 2; return rows * Math.max(cols, 1); } /** 아직 안 그린 카드 자리 — 진짜 카드와 같은 id · 높이. */ export function pendingCard(stationId: string, heightPx: number): HTMLElement { const slot = document.createElement("article"); slot.id = `cross-${stationId}`; slot.className = "b06-cross-card b06-cross-card--pending"; slot.style.height = `${heightPx}px`; return slot; }