fix(b06): 안 골라진 카드 첫 누름 = 눌린 대상 — 카드 고름이 연동 관으로 폼을 옮기지 않음 · 폼 여는 동안 선 도수로 상자를 새 상자로 안 고름 (294-8 · 295-4)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014utrjfoW831Vc5wJUd13kL
This commit is contained in:
2026-10-12 22:48:29 +09:00
co-authored by Claude Opus 5.5
parent a0a089a3d0
commit 2d356fac91
4 changed files with 184 additions and 10 deletions
@@ -191,8 +191,120 @@ DS.selectDesign(P, { chainageM: 110, structureId: null }, { partKey: "", from: "
DS.selectDesign(P, { chainageM: 110, structureId: null }, { from: "b06" }); // 그다음 카드 고름
out.firstLine = { oldKey, newKey: DS.readSelection(P)?.partKey ?? null };
// 다시 누름 = 풂 — 고름 표시(마이크로태스크)가 풀린 뒤
queueMicrotask(() => {
/* ── ⑤ 안 골라진 카드 첫 누름(294-8 · 295-4) — 페이지 흐름: 부재 고름 → 카드 고름 리스너 → 폼 엶 ──
* 폼은 열 때 두 번 그림(종류 칸 = 기본값 → 시설 값) — 둘째 그림에 도수로 상자가 섬. */
const tick = () => new Promise((done) => setTimeout(done, 0));
const flowSections = [
{ chainage_m: 90, station_id: "s90", ford_pavement: { chainage_m: 90, chute: {} } },
{ chainage_m: 95, station_id: "s95", culvert: { c: 95, chute: {} } },
{ chainage_m: 110, station_id: "s110", ford_pavement: { chainage_m: 110, chute: {} } },
];
const flowLog = [];
const box = (id) => {
const el = {
dataset: { specContainer: id, specIndex: "0" },
closest: (sel) => (sel.startsWith("fieldset") ? el : null),
};
return el;
};
let shown = null;
let boxes = [];
const handlers = {};
let flowPicked = null;
const flowControls = {
revetOffset: {
select: (at, key) => {
flowLog.push(["select", at, key]);
flowPicked = key ? { at, key } : null;
},
highlightFor: (s) => (flowPicked?.at === s.chainage_m ? flowPicked.key : null),
},
ford: { select: () => {} },
box: { select: () => {} },
structureSpan: {
// 연동 관 95 m 의 유출 흙막이가 4+10(90 m) 카드까지 옴(299)
ownerOf: (s) => (s.culvert ? s : s.chainage_m === 90 ? flowSections[1] : null),
},
inletStructure: { set: () => {}, valueFor: () => "auto" },
};
const paint = (ids) => {
boxes = ids.map(box);
handlers.specpaint?.forEach((fn) => fn());
};
const flowPanel = {
root: {
addEventListener: (type, fn) => (handlers[type] ??= []).push(fn),
querySelectorAll: () => boxes,
contains: () => false,
},
facility: { onInletStructureChange: () => {}, setInletStructure: () => {} },
currentChainage: () => shown,
showAtChainage: (at) => {
flowLog.push(["form", at]);
shown = at;
if (at === null) return { chainageM: null, structureId: null };
paint(at === 95 ? ["pipe"] : ["slope"]); // 종류 칸 = 기본값
paint(at === 95 ? ["pipe", "chute_add"] : ["slope", "chute"]); // 시설 값 = 도수로 상자 섬
return { chainageM: at, structureId: null };
},
releasePipe: () => flowLog.push(["release"]),
getStructures: () => [],
selectStructure: () => {},
};
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);
};
const esc = () => {
flowPicked = null;
shown = null;
boxes = [];
};
const flow = async (before, press) => {
esc();
before?.();
await tick();
flowLog.length = 0;
press();
const got = flowLog.map((entry) => [...entry]);
await tick();
return got;
};
// 형상 누름 = toggleRevet("pipe", 90) — 안 골라진 카드면 부재 고름 → onSelect
const slabPress = () => {
flowControls.revetOffset.select(90, "pipe", 90);
cardSelected(flowSections[0]);
};
// 보라 선 첫 누름 = pickLine — 남은 부재 풂 → onSelect
const linePress = () => {
flowControls.revetOffset.select(110, null);
cardSelected(flowSections[2]);
};
(async () => {
// 다시 누름 = 풂 — 고름 표시(마이크로태스크)가 풀린 뒤
await Promise.resolve();
out.owner.release = run(90, null, 90);
out.first = {
slabAfterEsc: await flow(null, slabPress),
slabAfterOther: await flow(() => flowPanel.showAtChainage(95), slabPress),
lineAfterEsc: await flow(null, linePress),
lineAfterOther: await flow(() => flowPanel.showAtChainage(95), linePress),
};
// 폼 안 [추가] · 단 늘림 = 그 상자 고름 그대로(54-30)
flowPanel.showAtChainage(95);
flowLog.length = 0;
paint(["pipe", "chute_add", "soil_add"]);
out.first.addBox = flowLog.map((entry) => [...entry]);
process.stdout.write(JSON.stringify(out));
});
})();
@@ -5,6 +5,8 @@
- 콘크리트 누름 = 그 물넘이(자기 id 누가거리) 고름 — 카드에 걸친 연동 관(95 m) · 자기 다른 관으로 안 감 ·
자기 관 없는 카드의 「관」 되살림도 물넘이 · 관 몸통 누름은 자기 관 그대로 · 다시 누름 = 풂
- 맹암거 형상 = 알림(목록이 id 로 고름) 그대로
- 294-8 · 295-4 안 골라진 카드 첫 누름 = 눌린 대상 — 카드 고름이 연동 관으로 폼을 옮기지 않음 · 폼을 열 때
두 번 그림(기본값 → 시설 값)에 선 도수로 상자를 「새 상자」로 골라 덮지 않음(Esc 뒤 · 다른 카드 고른 뒤)
실제 TS 를 `helper_294_7_ford_slab_pick.cjs` 가 Node 로 돌린다.
"""
@@ -84,3 +86,39 @@ def test_배선_경사각도_상자():
# 폼에 물넘이(관 상자 없음) = 「경사각도」 상자(294-2 그대로)
dock = _read("B06_Section_UI_Adjust_Dock.ts")
assert 'side === "pipe" && (!own || own.closest("[hidden]")) ? visibleBox(SLOPE_BOX)' in dock
def test_안_골라진_카드_콘크리트_첫_누름_294_8(out):
f = out["first"]
want = [["select", 90, "pipe"], ["remember", 90, "pipe"], ["form", 90], ["form", 90]]
assert f["slabAfterEsc"] == want # 옛 = 폼 95 · {at:95, key:"chute"}
assert f["slabAfterOther"] == want # 4+15 배관 고른 뒤도
def test_안_골라진_카드_보라_선_첫_누름_295_4(out):
f = out["first"]
want = [["select", 110, None], ["remember", 110, ""], ["release"], ["form", 110]]
assert f["lineAfterEsc"] == want # 옛 = {at:110, key:"chute"} · 선 풀림
assert f["lineAfterOther"] == want
def test_폼_안_새_상자는_그대로_고름(out):
assert out["first"]["addBox"] == [
["select", 95, "extra0"],
["remember", 95, "extra0"],
["form", 95],
]
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
sel = _read("B06_Section_UI_Page_Structures_Selection.ts")
assert "if (!born || chainageM === null || opening) return;" in sel