From a44b816773a9849eb0f3eae6e821403208db9f08 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Mon, 12 Oct 2026 22:52:02 +0900 Subject: [PATCH] =?UTF-8?q?refactor(b06):=20=EC=B9=B4=EB=93=9C=20=EA=B3=A0?= =?UTF-8?q?=EB=A6=84=20=ED=8F=BC=20=EC=9E=90=EB=A6=AC(formChainageOf)?= =?UTF-8?q?=EB=A5=BC=20=EC=84=A0=ED=83=9D=20=EB=B0=B0=EC=84=A0=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=EB=A1=9C=20=EC=98=AE=EA=B9=80=20=E2=80=94=20design=5F?= =?UTF-8?q?view=5Fcross=20685=EC=A4=84=20=ED=95=9C=EB=8F=84=20=EC=95=88=20?= =?UTF-8?q?=C2=B7=20=EB=8F=99=EC=9E=91=20=EA=B7=B8=EB=8C=80=EB=A1=9C=20(29?= =?UTF-8?q?4-8=20=ED=9B=84=EC=86=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL --- A00_Common/design/design_view_cross.ts | 7 +------ .../B06_Section_UI_Page_Structures_Selection.ts | 16 +++++++++------- resources/tester/helper_294_7_ford_slab_pick.cjs | 12 +++--------- resources/tester/test_294_7_ford_slab_pick.py | 13 +++++++------ 4 files changed, 20 insertions(+), 28 deletions(-) diff --git a/A00_Common/design/design_view_cross.ts b/A00_Common/design/design_view_cross.ts index 0fe92a61e..4aaa34321 100644 --- a/A00_Common/design/design_view_cross.ts +++ b/A00_Common/design/design_view_cross.ts @@ -57,7 +57,6 @@ import { import { createB06StructuresPanel } from "../../B06_Section/B06_Section_UI_Page_Structures_Panel"; import { isWallSelecting, - wallOwnerM, wireStructureSelection, } from "../../B06_Section/B06_Section_UI_Page_Structures_Selection"; import "../../B06_Section/B06_Section_UI_Style.css"; @@ -393,12 +392,8 @@ export async function mountCrossView( releaseCross(); // 카드 다시 누름 = 풀기 한 길(범위 테두리 · 형상까지 · 233-2) return; } - // 찍은 부재가 이미 연 시설이 먼저 — 물넘이 콘크리트가 걸친 연동 관으로 안 감(294-8) - const owner = isWallSelecting() - ? (wallOwnerM() ?? stationControls.structureSpan.ownerOf(target)?.chainage_m) - : undefined; const preferred = structuresPanel.preferred() !== null; - const opened = structuresPanel.showAtChainage(owner ?? target.chainage_m); + const opened = structuresPanel.showAtChainage(structureSelection.formChainageOf(target)); // 카드 하나 고름 = 그 측점(구조물 id 는 목록 · 알약 · 넘김이 고른 것만 · 189-1) const picked = preferred ? opened : { chainageM: opened.chainageM, structureId: null }; if (!isWallSelecting()) selectDesign(projectId, picked, { from: "b06" }); diff --git a/B06_Section/B06_Section_UI_Page_Structures_Selection.ts b/B06_Section/B06_Section_UI_Page_Structures_Selection.ts index e742ef5cb..73181ca11 100644 --- a/B06_Section/B06_Section_UI_Page_Structures_Selection.ts +++ b/B06_Section/B06_Section_UI_Page_Structures_Selection.ts @@ -5,7 +5,7 @@ * ========================================================================== */ import { refreshAdjustSlots } from "./B06_Section_UI_Adjust_Dock"; -import type { SectionDetailResponse } from "./B06_Section_Api_Fetch"; +import type { CrossSection, SectionDetailResponse } from "./B06_Section_Api_Fetch"; import type { StationControls } from "./B06_Section_UI_Page_Station_Controls"; import type { RevetPick } from "./B06_Section_UI_Cross_Culvert"; import type { B06StructuresPanel } from "./B06_Section_UI_Page_Structures_Panel"; @@ -28,10 +28,6 @@ export function isWallSelecting(): boolean { return wallSelecting; } -export function wallOwnerM(): number | null { - return wallSelecting ? wallOwner : null; -} - function markWallSelecting(owner: number | null = null): void { wallSelecting = true; wallOwner = owner; @@ -52,7 +48,7 @@ export function wireStructureSelection( refreshCard?: (chainageM: number) => void, /** 폼에 올린 시설로 보기를 옮김 — 목록에서 고른 길(54-47). */ reveal?: (chainageM: number) => void, -): { syncInletStructure: () => void } { +): { syncInletStructure: () => void; formChainageOf: (target: CrossSection) => number } { const ownerChainageOf = (chainageM: number, key?: RevetPick): number => { const sectionAt = detail()?.cross_sections.find( (entry) => Math.abs(entry.chainage_m - chainageM) < 0.01, @@ -247,5 +243,11 @@ export function wireStructureSelection( // 폼이 이 시설로 갈아 끼워진 뒤에 이식을 다시 돌린다 — 날개벽 칸이 그제야 선다. refreshAdjustSlots(); }; - return { syncInletStructure }; + /** 카드 고름이 폼에 올릴 자리 — 찍은 부재가 연 시설 먼저(걸친 연동 관 아님 · 294-8) · 그다음 소유 측점(79-6) · + * 카드만 고르면 그 측점. */ + const formChainageOf = (target: CrossSection): number => + (wallSelecting + ? (wallOwner ?? stationControls.structureSpan.ownerOf(target)?.chainage_m) + : undefined) ?? target.chainage_m; + return { syncInletStructure, formChainageOf }; } diff --git a/resources/tester/helper_294_7_ford_slab_pick.cjs b/resources/tester/helper_294_7_ford_slab_pick.cjs index dc9ca0321..b09b33ccb 100644 --- a/resources/tester/helper_294_7_ford_slab_pick.cjs +++ b/resources/tester/helper_294_7_ford_slab_pick.cjs @@ -251,20 +251,14 @@ const flowPanel = { getStructures: () => [], selectStructure: () => {}, }; -SEL.wireStructureSelection( +const flowWired = SEL.wireStructureSelection( flowControls, () => ({ cross_sections: flowSections }), flowPanel, (at, key) => flowLog.push(["remember", at, key]), ); -// 카드 고름 리스너(`design_view_cross` setStationSelectListener) 의 폼 자리 고르기 그대로 -const cardSelected = (target) => { - const owner = SEL.isWallSelecting() - ? (SEL.wallOwnerM() ?? flowControls.structureSpan.ownerOf(target)?.chainage_m) - : undefined; - flowControls.revetOffset.highlightFor(target); - flowPanel.showAtChainage(owner ?? target.chainage_m); -}; +// 카드 고름 리스너(`design_view_cross` setStationSelectListener) — 폼 자리는 배선이 돌려준 함수 그대로 +const cardSelected = (target) => flowPanel.showAtChainage(flowWired.formChainageOf(target)); const esc = () => { flowPicked = null; shown = null; diff --git a/resources/tester/test_294_7_ford_slab_pick.py b/resources/tester/test_294_7_ford_slab_pick.py index 8f369ca25..28349da3d 100644 --- a/resources/tester/test_294_7_ford_slab_pick.py +++ b/resources/tester/test_294_7_ford_slab_pick.py @@ -114,11 +114,12 @@ def test_배선_카드_고름_리스너(): with open( os.path.join(ROOT, "A00_Common", "design", "design_view_cross.ts"), encoding="utf-8" ) as f: - cross = " ".join(f.read().split()) - assert ( - "const owner = isWallSelecting() ? (wallOwnerM() ?? stationControls.structureSpan.ownerOf(target)?.chainage_m) : undefined;" - in cross - ) - assert "structuresPanel.showAtChainage(owner ?? target.chainage_m)" in cross + raw = f.read() + cross = " ".join(raw.split()) + assert "structuresPanel.showAtChainage(structureSelection.formChainageOf(target))" in cross + assert len(raw.splitlines()) <= 685 # 233-2 · 233-3 · 298 한도 sel = _read("B06_Section_UI_Page_Structures_Selection.ts") + assert "(wallOwner ?? stationControls.structureSpan.ownerOf(target)?.chainage_m)" in " ".join( + sel.split() + ) assert "if (!born || chainageM === null || opening) return;" in sel