diff --git a/B05_Profile/B05_Profile_UI_Drainage_Facility.ts b/B05_Profile/B05_Profile_UI_Drainage_Facility.ts index 8469ecd8..a9f53b27 100644 --- a/B05_Profile/B05_Profile_UI_Drainage_Facility.ts +++ b/B05_Profile/B05_Profile_UI_Drainage_Facility.ts @@ -385,6 +385,10 @@ export function createFacilityOptionsForm( let designFlowM3s: number | null = null; /** 현재 조건(설계유량·월류 폭)의 필요 최소 수심(m). 계산 불가면 null. */ let fordMinDepthM: number | null = null; + /** 직전에 자동으로 채워 넣은 필요 수심(m) — 칸이 아직 그 값이면 "자동"으로 보고 + * 월류 폭이 바뀔 때마다 계산값을 계속 따라가게 한다. 사용자가 다른 값을 넣으면 + * 그때부터 그 값이 이긴다(2026-08-30 사용자: 폭을 바꿔도 높이가 안 따라온다). */ + let fordAutoDepthM: number | null = null; function syncFordSummary(): void { const section = @@ -393,10 +397,14 @@ export function createFacilityOptionsForm( : null; fordMinDepthM = section ? section.depthM : null; if (section) { - // 표시 정밀도(0.01m)로 맞춘 최소값 — 비었거나 그보다 작으면 계산값으로 채운다. + // 표시 정밀도(0.01m)로 맞춘 최소값 — 비었거나, 그보다 작거나, 아직 직전 + // 자동값 그대로면 계산값으로 다시 채운다. const min = Number(section.depthM.toFixed(2)); const current = Number.parseFloat(fordHeight.value); - if (!Number.isFinite(current) || current < min) fordHeight.value = min.toFixed(2); + const untouched = fordAutoDepthM !== null && Math.abs(current - fordAutoDepthM) < 0.005; + if (!Number.isFinite(current) || current < min || untouched) + fordHeight.value = min.toFixed(2); + fordAutoDepthM = min; } if (designFlowM3s === null) { fordSummary.textContent = @@ -615,6 +623,8 @@ export function createFacilityOptionsForm( fordCount.value = isFord ? text("pipe_count") : ""; fordWidth.value = text("ford_width_m"); fordHeight.value = text("ford_height_m"); + // 새 시설을 올리는 참이다 — 저장된 높이는 사용자 값으로 보고 자동 추적을 끊는다. + fordAutoDepthM = null; fordSlope.value = text("ford_slope_pct"); revetSide.value = text("side") || "양쪽"; const spread = legacyRevetOptions(options);