From ec28d9d451b8066d97b3ee8ad83d73ea8b5475f9 Mon Sep 17 00:00:00 2001 From: umsangdon Date: Fri, 16 Oct 2026 13:07:20 +0900 Subject: [PATCH] =?UTF-8?q?feat(=ED=9A=A1=EB=8B=A8=EB=B3=B4=EA=B8=B0):=203?= =?UTF-8?q?46-2=20=EB=8D=A7=203=20=EB=85=B8=EC=84=A0=20=EC=B4=88=EC=95=88?= =?UTF-8?q?=20=EB=8F=99=EC=95=88=20=ED=9A=A1=EB=8B=A8=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=20=3D=20=EB=AC=B6=EC=9D=8C=20=EC=83=88=20=EB=85=B8=EC=84=A0=20?= =?UTF-8?q?=EC=83=81=EC=84=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Station_Swap shownDetail: 노선 초안 동안 카드가 그릴 상세 = pipelineDetail(cross 단계 결과) · 없으면 저장 노선 캐시 - followSwaps 가 묶음 profile · cross 단계 뒤 새 상세를 들음 — 보일 때만 다시 그림(보이는 카드 먼저 길 그대로) · 숨었으면 다시 보일 때 - 묶음은 종단 보기가 세움 — 차례 번호(가게 generation)가 날 때 붙음 · 초안 버리면 상세 null = 저장 노선 카드 - design_view_cross 2줄(가져오기 · 그리기 상세) · 685 줄 그대로 · 저장 · 재계산 길은 저장 노선 상세 그대로 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy --- A00_Common/design/design_view_cross.ts | 4 +- .../B06_Section_UI_Page_Station_Swap.ts | 41 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/A00_Common/design/design_view_cross.ts b/A00_Common/design/design_view_cross.ts index 066a628c7..1abcf1a1b 100644 --- a/A00_Common/design/design_view_cross.ts +++ b/A00_Common/design/design_view_cross.ts @@ -38,7 +38,7 @@ import { readStructurePick } from "../../B05_Profile/B05_Profile_UI_Structure_Pi import { NO_SELECTION, PIPE_MATCH_M, selectDesign } from "./design_selection"; import { paintMapPick } from "./design_pick_profile"; import { watchDrafts } from "./design_structure_status"; -import { followSwaps } from "../../B06_Section/B06_Section_UI_Page_Station_Swap"; +import { followSwaps, shownDetail } from "../../B06_Section/B06_Section_UI_Page_Station_Swap"; import { savingDesign } from "./design_save"; import { applyStructurePick } from "../../B06_Section/B06_Section_UI_Page_Structure_Pick"; import { bindCrossPick } from "../../B06_Section/B06_Section_UI_Page_Pick_Sync"; @@ -515,7 +515,7 @@ export async function mountCrossView( showSectionView(); // 높이 배율은 항상 1(2026-08-06 사용자 지시 — 옵션 폐지). sectionView.render( - sectionDetail, + shownDetail(projectId, sectionDetail), // 노선 초안 동안 = 새 노선 횡단(346-2 덧 3) 1, crossHalfWidth(), stationInterval, diff --git a/B06_Section/B06_Section_UI_Page_Station_Swap.ts b/B06_Section/B06_Section_UI_Page_Station_Swap.ts index 6a2c0db26..5e8d19612 100644 --- a/B06_Section/B06_Section_UI_Page_Station_Swap.ts +++ b/B06_Section/B06_Section_UI_Page_Station_Swap.ts @@ -4,11 +4,22 @@ * 상세 객체를 갈아끼우고(`swapSectionStations` · 조정창 값 · 암 경계 · 암 경사 옮김은 `onAnySwap` 이 맡음) 보일 때 * 카드 · 종단도를 다시(카드는 보이는 것 먼저 · 다시 셈은 그 길이 맡음 · 안 보이면 다시 보일 때 그림). * 종단 보기도 같은 가게를 듣고 같은 함수를 부름 — 먼저 부른 쪽이 갈아끼우고 다음 쪽은 「같은 목록」. + * 노선 초안 동안(346-2 덧 3) 카드 = 묶음 새 노선 상세(`pipelineDetail` · cross 단계 결과) — 새 상세가 오면 + * 같은 길로 다시 그림 · 초안을 버리면(상세 null) 저장 노선 카드로. * ========================================================================== */ import { useDesignStore } from "../A00_Common/design/design_store"; +import type { DesignPipeline } from "../A00_Common/design/design_pipeline"; +import { pagePipeline, pipelineDetail } from "../A00_Common/design/design_pipeline_page"; +import type { SectionDetailResponse } from "./B06_Section_Api_Types"; import { onAnySwap, swapSectionStations } from "./B06_Section_Section_Store"; +/** 카드가 그릴 상세 — 노선 초안 동안 묶음 새 노선 상세 · 아니면 저장 노선(캐시). */ +export const shownDetail = ( + projectId: string | null, + saved: SectionDetailResponse, +): SectionDetailResponse => (projectId && pipelineDetail(projectId)) || saved; + /** 묶음 측점을 따라감 — 돌려준 함수로 끊음. `redraw` = 캐시에서 상세를 다시 읽어 카드 · 그림 다시. */ export function followSwaps( projectId: string | null, @@ -23,8 +34,38 @@ export function followSwaps( const route = routeId(); if (route !== null && stations?.length) void swapSectionStations(projectId, route, stations); }); + const stopDraft = followDraftDetail(projectId, () => void (host.visible() && redraw())); return () => { stopRedraw(); stopStore(); + stopDraft(); + }; +} + +/** 묶음 새 노선 상세가 바뀌면(profile · cross 단계 뒤) 부름 — 묶음은 종단 보기가 세우므로 차례 번호가 날 때 붙음. */ +function followDraftDetail(projectId: string, changed: () => void): () => void { + let pipe: DesignPipeline | null = null; + let stopPipe = (): void => undefined; + let drawn = pipelineDetail(projectId); + const attach = (): void => { + const now = pagePipeline(projectId); + if (now === pipe) return; + stopPipe(); + pipe = now; + stopPipe = + now?.subscribe((event) => { + if (event.kind !== "stage" || (event.stage !== "profile" && event.stage !== "cross")) + return; + const next = pipelineDetail(projectId); + if (next === drawn) return; + drawn = next; + changed(); + }) ?? ((): void => undefined); + }; + attach(); + const stopStore = useDesignStore(projectId, null).subscribe("generation", attach); + return () => { + stopStore(); + stopPipe(); }; }