Files
Aislo/B05_Profile/B05_Profile_UI_Page_Life.ts
T
eomsangdonandClaude Opus 5.5 90a2cb9a11 refactor(B05·B06): 한 페이지 뼈대 — 주소 둘이 같은 페이지(design_page) · 같은 페이지 안 이동은 보기만 바꿈 · 떠날 때 3D · 종단도 · 횡단 정리 · 숨긴 3D 그리기 멈춤 · 창 키 듣기 뗌 · 뷰어 나눔(771→541)
- 라우터: 여러 주소 페이지(MountedPage) 길 · 같은 페이지면 셸도 다시 안 그림 · 떠나면 dispose · 늦게 끝난 옛 렌더 버림
- design_page: 보기 약속 DesignPageView(mount 중간 단계 · mountCenter 끝 모습 + shared 한 벌 자리) · host.onShow · onHide · onDispose
- 3D 뷰어: setActive(루프 멈춤 · 창 포인터 뗌) · dispose 가 WebGL 문맥까지 놓음 · 보관 지형은 남김 · 코리도 조각을 Viewer_Corridor 로
- 종단도: setActive(창 키 듣기 뗌 · 보일 때 초안 · 판 다시 읽음)
- 겹친 알약: 같은 측점이면 누른 알약을 그대로(24-6b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BU9gbNE3aWFUvE61pS2WGt
2026-09-29 21:39:31 +09:00

49 lines
2.1 KiB
TypeScript

/* =============================================================================
* B05_Profile_UI_Page_Life.ts
* 종단 보기의 숨김 · 보임 · 떠남(한 페이지 두 보기 · 계획서 24-3a).
*
* 숨으면 3D 그리기 루프 · 창 키 · 포인터 듣기를 뗀다. 다시 보이면 잇고, 다른 보기(횡단)에서
* 바뀐 구조물 · 관 · 계획고 초안 · 고른 것을 가게에서 다시 읽는다. 떠나면 3D(WebGL 문맥까지) ·
* 종단도를 정리한다. 페이지 본체가 700줄을 넘어 여기로 뗐다.
* ========================================================================== */
import type { DesignPageHost } from "../A00_Common/design/design_page";
import { readSelection } from "../A00_Common/design/design_selection";
export interface ProfileViewLifeDeps {
projectId: string;
viewer: { setActive: (active: boolean) => void; dispose: () => void };
profile: { setActive: (active: boolean) => void; dispose: () => void };
/** 첫 진입 로딩이 끝났는가 — 끝나기 전에는 다시 읽지 않는다. */
ready: () => boolean;
/** 구조물 목록을 다시 읽는다(초안 우선). */
reload: () => Promise<void>;
structures: () => { selectById: (structureId: string | null) => void };
/** 가게에 남은 고른 것을 되살린다(이미 고른 것이 있으면 그대로). */
restorePick: () => void;
}
export function bindProfileViewLife(host: DesignPageHost, deps: ProfileViewLifeDeps): void {
let pickAtHide = "";
const pickNow = (): string => JSON.stringify(readSelection(deps.projectId));
host.onHide(() => {
deps.viewer.setActive(false);
deps.profile.setActive(false);
pickAtHide = pickNow();
});
host.onShow(() => {
deps.viewer.setActive(true);
deps.profile.setActive(true);
if (!deps.ready()) return;
void deps.reload().then(() => {
// 다른 보기에서 다른 것을 골랐으면 지금 고른 것을 풀고 그것을 되살린다.
if (pickNow() !== pickAtHide) deps.structures().selectById(null);
deps.restorePick();
});
});
host.onDispose(() => {
deps.viewer.dispose();
deps.profile.dispose();
});
}