-- ① 읽기: 시트 두 장 — Options(설정) · Chapters(한 줄 = 한 장)load :: IO ([Row], [Row])load = csv "csv/Options.csv" "csv/Chapters.csv" -- 저장소에 CSV 가 있으면 먼저 <|> sheetsV4 apiKey sheetId ["Options", "Chapters"] -- 없으면 values/<탭>?key= · 첫 줄이 열 이름settings :: [Row] -> Map Label Stringsettings = fromList . map (\r -> (r ! "Setting", r ! "Customize")) -- 코드는 constants.js 를 거쳐 읽는다: _mapTitle → 'Storymap Title'. 비어 있으면 기본값-- ② 그리기: 한 줄 → 글 블록 하나 + (좌표가 있으면) 마커 하나chapter :: Row -> (Block, Maybe Marker) -- Marker 열: Numbered → 번호 · Plain → 빈 아이콘 · Hidden → 투명·클릭 안 됨 · 그 밖 → 그 글자 -- Media Link: youtube.com → iframe · jpg·png·gif·tiff → img · mp3·ogg·wav → audio-- ③ 스크롤 → 지금 장. 블록 높이는 처음 한 번 재서 누적한다top :: [Px]top = scanl (\y h -> y + h + 70) (-100) heights ++ [maxBound]chapterAt :: Px -> Maybe IntchapterAt y = find (\i -> top !! i <= y && y < top !! (i + 1) - 140) [0 ..] -- 다음 장 시작 140px 전부터는 어느 장도 아니다 → 지금 장이 그대로 남는다onFocus :: Int -> [Effect]onFocus i = [ Hash (i + 1), InFocus i, MarkerActive i , RemoveOverlays, Overlay (c ! "Overlay"), GeoJson (c ! "GeoJSON Overlay") , FlyTo (lat c, lon c) (zoom c `orElse` 15) 2 ] where c = chapters !! i -- Overlay: .geojson 이면 GeoJSON, 아니면 타일 URL 로 본다 -- GeoJSON Feature Properties 칸은 "color: red; weight: 2" 를 파싱한다. 스타일은 feature 값 → 이 칸 → 기본값 순-- 반대 방향: 마커를 누르면 글이 top !! i + 5 로 스크롤된다-- 처음: 모든 마커로 fitBounds. URL 에 #n 이 있으면 n 번째 장으로 스크롤한다