조정창에서 좌·우 끝을 따로 잡는다 — ◀▶는 구체 길이, ▲▼는 그 끝의 구체 표고를 0.1m씩 움직인다. 좌·우 표고가 달라지면 구체가 기울고, 날개벽 구간 바닥(에이프런)은 각 끝 표고에서 수평을 지킨다(2026-08-25 사용자). - `computeBoxLayout`이 좌·우를 따로 푼다: 끝 표고·길이·성토선·에이프런 - 성토선은 그쪽 표고 기준으로 물매 1:1.2를 지키므로 표고를 내리면 구체가 길어진다 - 조정창 `_Cross_Box_Panel.ts` + 제어 `createBoxControls` + `design.box_adjust` 저장 (세션 → 캐시 → 확정 payload, 세월교와 같은 체계) - 3D: 구체 밖(날개벽 구간)에 서 있던 벽을 없앴다 — 천장 없는 통로가 생기던 자리는 날개벽 몫이다. 이제 상판·구체 저판·측벽 2매·에이프런 2매 + 날개벽 4매로 나뉜다 - 카드 렌더러의 구체 배선(선택 토글·강조·조정창)을 `_Cross_View_Bodies.ts`로 분리, 연동 플래그 세션은 `_Page_Link_Session.ts`로 분리(700줄 제한) 검증(10+0.9): 구체 5.34m·수평 → ◀ 1회 5.44m → ▼ 2회 표고 −0.2m·물매 1:28.4, 에이프런 두 장 모두 수평 유지, ↺ 원복. 3D 솔리드 10개(측벽 링 0.2m). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
144 lines
5.1 KiB
TypeScript
144 lines
5.1 KiB
TypeScript
/* =============================================================================
|
|
* B06_Section_UI_Cross_View_Bodies.ts
|
|
* 횡단 카드 ↔ **구체 구조물(세월교·BOX암거)** 배선 한 벌 — 선택 토글·강조 setter·
|
|
* 조정창을 묶어 카드 렌더러(`_UI_Cross_View.ts`)에서 700줄 제한으로 분리했다
|
|
* (2026-08-25). 기하나 그리기는 하지 않는다.
|
|
* ========================================================================== */
|
|
|
|
import type { CrossSection } from "./B06_Section_Api_Fetch";
|
|
import type {
|
|
FordAdjust,
|
|
FordHighlightSetter,
|
|
FordLayout,
|
|
FordWallRole,
|
|
} from "./B06_Section_UI_Cross_Ford";
|
|
import { buildFordPanel } from "./B06_Section_UI_Cross_Ford_Panel";
|
|
import type { FordControl, FordPanelHandle } from "./B06_Section_UI_Cross_Ford_Panel";
|
|
import { fordCardState, fordPanelDeps } from "./B06_Section_UI_Cross_View_Ford";
|
|
import type {
|
|
BoxAdjust,
|
|
BoxHighlightSetter,
|
|
BoxLayout,
|
|
BoxSideRole,
|
|
} from "./B06_Section_UI_Cross_Box";
|
|
import { buildBoxPanel } from "./B06_Section_UI_Cross_Box_Panel";
|
|
import type { BoxControl, BoxPanelHandle } from "./B06_Section_UI_Cross_Box_Panel";
|
|
import { boxPanelDeps, structureToggle } from "./B06_Section_UI_Cross_View_Box";
|
|
|
|
export interface BodyWiringDeps {
|
|
section: CrossSection;
|
|
ford?: FordControl;
|
|
box?: BoxControl;
|
|
/** 카드가 지금 선택 상태인가 — 구조물을 고르면 카드도 함께 선택된다. */
|
|
isCardSelected: () => boolean;
|
|
/** 면적 강조 해제(구조물 선택과 배타). */
|
|
clearArea: () => void;
|
|
selectCard: () => void;
|
|
}
|
|
|
|
export interface BodyWiring {
|
|
fordAdjust: () => FordAdjust | undefined;
|
|
boxAdjust: () => BoxAdjust | undefined;
|
|
toggleFord: (role: FordWallRole) => void;
|
|
toggleBox: (role: BoxSideRole) => void;
|
|
/** 오버레이가 만들어 준 강조 setter를 등록하고 현재 선택을 다시 칠한다. */
|
|
attachFord: (setter: FordHighlightSetter, layout: FordLayout) => void;
|
|
attachBox: (setter: BoxHighlightSetter, layout: BoxLayout) => void;
|
|
/** 카드 선택이 풀리거나 면적이 켜지면 구조물 선택도 푼다. */
|
|
clearSelection: () => void;
|
|
panels: Array<FordPanelHandle | BoxPanelHandle>;
|
|
}
|
|
|
|
export function createBodyWiring(deps: BodyWiringDeps): BodyWiring {
|
|
const { section, ford, box } = deps;
|
|
const chainage = section.chainage_m;
|
|
let fordRole = section.ford ? (ford?.selectedFor(chainage) ?? null) : null;
|
|
let boxRole = section.box ? (box?.selectedFor(chainage) ?? null) : null;
|
|
let setFordActive: FordHighlightSetter = () => {};
|
|
let setBoxActive: BoxHighlightSetter = () => {};
|
|
let fordSlabLengthM = 0;
|
|
let fordHeights = new Map<FordWallRole, number>();
|
|
let boxLayout: BoxLayout | null = null;
|
|
|
|
const fordPanel =
|
|
section.ford && ford
|
|
? buildFordPanel(
|
|
fordPanelDeps({
|
|
section,
|
|
ford,
|
|
heightFor: (role) => fordHeights.get(role) ?? 0,
|
|
slabLengthM: () => fordSlabLengthM,
|
|
close: () => {
|
|
if (fordRole) toggleFord(fordRole);
|
|
},
|
|
}),
|
|
)
|
|
: null;
|
|
const boxPanel =
|
|
section.box && box
|
|
? buildBoxPanel(
|
|
boxPanelDeps({
|
|
chainageM: chainage,
|
|
box,
|
|
layout: () => boxLayout,
|
|
close: () => {
|
|
if (boxRole) toggleBox(boxRole);
|
|
},
|
|
}),
|
|
)
|
|
: null;
|
|
|
|
const toggleFord = structureToggle<FordWallRole>({
|
|
current: () => fordRole,
|
|
setCurrent: (value) => (fordRole = value),
|
|
setActive: (value) => setFordActive(value),
|
|
showPanel: (visible) => fordPanel?.show(visible ? fordRole : null),
|
|
persist: (value) => ford?.select(chainage, value),
|
|
isCardSelected: deps.isCardSelected,
|
|
clearArea: deps.clearArea,
|
|
selectCard: deps.selectCard,
|
|
});
|
|
const toggleBox = structureToggle<BoxSideRole>({
|
|
current: () => boxRole,
|
|
setCurrent: (value) => (boxRole = value),
|
|
setActive: (value) => setBoxActive(value),
|
|
showPanel: (visible) => boxPanel?.show(visible ? boxRole : null),
|
|
persist: (value) => box?.select(chainage, value),
|
|
isCardSelected: deps.isCardSelected,
|
|
clearArea: deps.clearArea,
|
|
selectCard: deps.selectCard,
|
|
});
|
|
|
|
fordPanel?.show(fordRole);
|
|
boxPanel?.show(boxRole);
|
|
|
|
return {
|
|
fordAdjust: () => ford?.adjustFor(chainage),
|
|
boxAdjust: () => box?.adjustFor(chainage),
|
|
toggleFord,
|
|
toggleBox,
|
|
attachFord: (setter, layout) => {
|
|
setFordActive = setter;
|
|
const state = fordCardState(layout);
|
|
fordSlabLengthM = state.slabLengthM;
|
|
fordHeights = state.heights;
|
|
if (fordRole) setter(fordRole);
|
|
// 창은 그리기 전에 만들어져 값이 비어 있다 — 계산 결과가 들어온 뒤 다시 렌더한다.
|
|
fordPanel?.show(fordRole);
|
|
},
|
|
attachBox: (setter, layout) => {
|
|
setBoxActive = setter;
|
|
boxLayout = layout;
|
|
if (boxRole) setter(boxRole);
|
|
boxPanel?.show(boxRole);
|
|
},
|
|
clearSelection: () => {
|
|
if (fordRole !== null) toggleFord(fordRole);
|
|
if (boxRole !== null) toggleBox(boxRole);
|
|
},
|
|
panels: [fordPanel, boxPanel].filter(
|
|
(panel): panel is FordPanelHandle | BoxPanelHandle => !!panel,
|
|
),
|
|
};
|
|
}
|