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
@@ -21,15 +21,23 @@ import { BERM_TYPE_ID } from "./B06_Section_UI_Page_Persist";
* 이 값으로 "카드만 고른 경우"를 가려낸다(2026-08-29 사용자: 측점 선택 때 구조물이
* 자동으로 골라지면 안 된다). 같은 턴에서만 참이다. */
let wallSelecting = false;
/** 이번 턴에 찍은 부재가 폼에 올린 시설 자리 — 안 골라진 카드 첫 누름에 카드 고름이 연동 관으로 다시 옮기지 않게(294-8). */
let wallOwner: number | null = null;
export function isWallSelecting(): boolean {
return wallSelecting;
}
function markWallSelecting(): void {
export function wallOwnerM(): number | null {
return wallSelecting ? wallOwner : null;
}
function markWallSelecting(owner: number | null = null): void {
wallSelecting = true;
wallOwner = owner;
queueMicrotask(() => {
wallSelecting = false;
wallOwner = null;
});
}
@@ -81,12 +89,12 @@ export function wireStructureSelection(
stationControls.revetOffset.select = (chainageM, key, ownerM) => {
// 다른 카드 부재를 고르는 중에 옛 카드가 제 선택을 푸는 것 — 폼 · 선택 칸은 새 것 몫(53-1)
const nested = wallSelecting;
// 푸는 것은 고름이 아님 — 표시를 켜면 뒤이은 카드 고름이 선택 칸에 안 적힘(53-1)
if (key) markWallSelecting();
origRevet(chainageM, key);
// 도수로 띠는 자기 측점 시설 — 이웃 관 연장 안이어도 그 관 폼을 안 엶(152-4)
const owner =
ownerM ?? (key === "chute" ? chainageM : ownerChainageOf(chainageM, key ?? undefined));
// 푸는 것은 고름이 아님 — 표시를 켜면 뒤이은 카드 고름이 선택 칸에 안 적힘(53-1)
if (key) markWallSelecting(owner);
origRevet(chainageM, key);
if (key) remember?.(owner, key);
if (key) panel.showAtChainage(owner);
else if (!nested) {
@@ -163,6 +171,18 @@ export function wireStructureSelection(
if (!pointing) pressAt(event.target as HTMLElement);
});
panel.root.addEventListener("change", ({ target: el }) => pickAt(el as HTMLElement));
// 시설을 폼에 여는 동안의 그림(종류 칸 → 값 채움 두 번)은 새 상자가 아님 — 마지막 상자(도수로)를
// 고르면 누른 선 · 형상을 덮음(294-8 · 295-4)
let opening = false;
const origShow = panel.showAtChainage;
panel.showAtChainage = (chainageM) => {
opening = true;
try {
return origShow(chainageM);
} finally {
opening = false;
}
};
// 상자가 새로 서면(단 늘림 · [추가]) 그 상자를 고름 — 같은 시설을 다시 그린 때만
let painted: { chainageM: number | null; keys: Set<string> } | null = null;
panel.root.addEventListener("specpaint", () => {
@@ -171,7 +191,7 @@ export function wireStructureSelection(
const before = painted?.chainageM === chainageM ? painted.keys : null;
painted = { chainageM, keys: new Set(boxes.map(fieldOf)) };
const born = before ? boxes.filter((box) => !before.has(fieldOf(box))).at(-1) : undefined;
if (!born || chainageM === null) return;
if (!born || chainageM === null || opening) return;
revealAt(chainageM, null);
pickBox(born);
});