Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWh5wNNycMkbwMpACz1rte
30 lines
1.4 KiB
TypeScript
30 lines
1.4 KiB
TypeScript
/* =============================================================================
|
|
* B06_Section_Display_Width.ts
|
|
* 횡단 보기 반폭(보기값 · m) 한 벌 — B06 좌측 「횡단 반폭」 입력칸 · B05 평면 우측 횡단 판이 같이 읽음(393-4).
|
|
*
|
|
* 세션 조절값([보기 반폭 적용] · 노선 단위) > 측점 저장 표시 반폭 최댓값 > 표시 기본 10m(PLAN 79-4).
|
|
* ⚠ `data.options.cross_half_width_m` 은 샘플링(계산) 반폭 — 보기값 아님.
|
|
* ========================================================================== */
|
|
|
|
import { readStateRaw } from "../A00_Common/b_page_state";
|
|
import type { CrossSection } from "./B06_Section_Api_Fetch";
|
|
|
|
/** 표시 기본 반폭(m) — 계산 기본(20m)과 다름(2026-08-19 사용자 지시). */
|
|
export const DISPLAY_HALF_WIDTH_DEFAULT_M = 10;
|
|
|
|
export function displayHalfWidth(
|
|
projectId: string,
|
|
routeId: number | null,
|
|
sections: readonly CrossSection[],
|
|
): number {
|
|
const session = Number(
|
|
routeId === null ? NaN : readStateRaw("cross-display", projectId, routeId),
|
|
);
|
|
if (Number.isFinite(session) && session > 0) return session;
|
|
// 측점마다 다를 수 있음 — 가장 넓은 값(잘림 방지)
|
|
const saved = sections
|
|
.map((section) => section.design?.display_half_width_m)
|
|
.filter((width): width is number => typeof width === "number" && width > 0);
|
|
return saved.length ? Math.max(...saved) : DISPLAY_HALF_WIDTH_DEFAULT_M;
|
|
}
|