diff --git a/B05_Profile/B05_Profile_UI_Profile_Table.ts b/B05_Profile/B05_Profile_UI_Profile_Table.ts index 687d051ea..3dd442f14 100644 --- a/B05_Profile/B05_Profile_UI_Profile_Table.ts +++ b/B05_Profile/B05_Profile_UI_Profile_Table.ts @@ -586,24 +586,37 @@ export function createProfileTable(options: ProfileTableOptions): HTMLElement { table.append( ...buildSegmentRows(alignment, x, fontSize, rowHeight, structureChainages, selectedChainageM), ); - // 이웃 칸과 겹치는 값 칸(1.6 m 이웃 등)은 그 자리에서 세움 — 두께 = 이웃 사이 틈(407-5 · 곡선 행과 같은 규칙) - const stationThickness = crowdedThickness( - alignment.stations.map((station, stationIndex) => - isNearChainage(station.chainage_m, structureChainageList) ? null : centers[stationIndex], + // 이웃 칸과 글이 겹치는 값 칸(1.6 m 이웃 등)만 그 자리에서 세움 — 판정 = 세 행 가운데 가장 긴 글 폭 · + // 두께 = 이웃 사이 틈(407-5 · 곡선 행과 같은 함수) + const stationSpecs = buildStationRows(alignment, stationInterval, display); + const isStructural = alignment.stations.map((station) => + isNearChainage(station.chainage_m, structureChainageList), + ); + const longest = Math.max( + 0, + ...stationSpecs.flatMap((spec) => + alignment.stations.map((_, stationIndex) => + isStructural[stationIndex] ? 0 : spec.cell(stationIndex).length, + ), ), - cellWidth, + ); + const stationThickness = crowdedThickness( + alignment.stations.map((_, stationIndex) => + isStructural[stationIndex] ? null : centers[stationIndex], + ), + longest * fontSize * CHAR_WIDTH_EM + CELL_PADDING_PX * 2, CURVE_ROTATED_WIDTH_PX, ); - buildStationRows(alignment, stationInterval, display).forEach((spec, index) => { + stationSpecs.forEach((spec, index) => { const row = createRow( `${spec.modifier ? `is-${spec.modifier}` : ""}${index === 0 ? " is-group-start" : ""}`, spec.label, spec.unit, ); // 값이 없는 측점(절토고/성토고 중 한쪽)도 빈 칸을 만들어야 세로 구분선이 끊기지 않는다. - alignment.stations.forEach((station, stationIndex) => { + alignment.stations.forEach((_, stationIndex) => { // 구조물 측점 열은 기본값을 비운다 — 격자(빈 셀)만 남기고 값은 선택 오버레이가 맡는다. - const structural = isNearChainage(station.chainage_m, structureChainageList); + const structural = isStructural[stationIndex]; const cell = element( "span", `b05-profile-table__cell${structural ? " is-structure" : ""}`,