Files
Aislo/B05_Profile/B05_Profile_UI_Structures_Panel_Pipes.ts
T
eomsangdonandClaude Opus 5.5 65b4b13ed7 refactor(472-5 5-A 나눔): 구조물 · 배수 판 셋 690줄 넘음 — 동작 같게 나눔
- B06_Section_UI_Page_Structures_Panel 700 → 타입을 _Panel_Types 로(다시 내보냄)
- B05_Profile_UI_Structures_Panel 693 → 관 목록 받기(임시 · 고른 관 따라감)를 _Panel_Pipes 로
- B05_Profile_UI_Drainage_Panel 691 → 표시 토글 상태를 _Drainage_Show 로
- 시험 test_233_3 — 옮긴 줄을 새 파일에서 읽음(까닭: 같은 줄이 자리만 옮김)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 09:42:53 +09:00

43 lines
2.3 KiB
TypeScript

/* =============================================================================
* B05_Profile_UI_Structures_Panel_Pipes.ts
* 「구조물 배치」 폼이 관 목록을 받는 몫 — 임시 관 · 고른 관이 조금 옮겨져도 따라감
* (`B05_Profile_UI_Structures_Panel.ts` setPipeFacilities 에서 나눔 · 472-5 · 동작 같음).
* ========================================================================== */
import { PIPE_MATCH_M } from "../A00_Common/design/design_selection";
import type { StructuresEventContext } from "./B05_Profile_UI_Structures_Panel_Events";
import type { PipeFacilityItem } from "./B05_Profile_UI_Structures_Panel_Types";
/** 새 관 목록(`list` = 이미 갈아 낀 폼 목록) — 임시 · 고른 관 누가거리 따라감 · 사라지면 폼 닫음. */
export function followPipeList(ctx: StructuresEventContext, list: PipeFacilityItem[]): void {
const temp = ctx.tempPipeChainage();
if (temp !== null) {
// 스냅·재계산으로 좌표가 조금 옮겨진 임시 관을 계속 따라간다.
const hit = list.find((pipe) => Math.abs(pipe.chainage_m - temp) < PIPE_MATCH_M);
if (hit) {
ctx.setTempPipeChainage(hit.chainage_m);
if (ctx.selectedPipeChainage() !== null) ctx.setSelectedPipeChainage(hit.chainage_m);
// 재계산이 끝나 도착한 담당 유역 설계유량을 입력 중인 폼에 반영한다 —
// 물넘이·세월교 월류 높이가 이 값으로 계산된다(2026-08-18 진단: 재계산
// 후 선택 통지가 조용히 끝나 폼이 유량을 못 받던 문제).
ctx.facilityOptions.setDesignFlow(hit.design_flow_m3s ?? null);
} else {
// 임시 배치 관이 재계산에서 사라졌다 — 임시 상태만 정리(관은 이미 없다).
ctx.setTempPipeChainage(null);
ctx.syncButtons();
}
}
const kept = list.find(
(pipe) => Math.abs(pipe.chainage_m - (ctx.selectedPipeChainage() ?? NaN)) < PIPE_MATCH_M,
);
if (kept)
ctx.setSelectedPipeChainage(kept.chainage_m); // 조금 옮겨진 관도 고름 따라감(233-3)
else if (ctx.selectedPipeChainage() !== null) {
// 고르고 있던 관이 사라졌다(삭제·재계산 이동) — 폼도 함께 닫는다.
ctx.setSelectedPipeChainage(null);
ctx.facilityOptions.setFacility(null);
ctx.syncButtons();
}
ctx.renderList();
}