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