feat(D 예정노선): 노드마다 긋기 방식 · 값 기록 — 꼭짓점과 같이 움직임 · 옮긴 노드 기록 남기고 경고 고리 (PLAN 599-2 · 요구 463-11)
- 점 찍을 때 그때 방식 · 값을 nodes 칸에(594-1 꼴 · 붙은 점 = 자유 · 처음 기록 = 앞 노드 기록 없음) - 끼움 · 더함 · 뺌 · 지움 · 뒤집기(토막 끝 노드 몫 한 칸 밀림) · 잇기 · 다시 긋기(뒤 노드 = 자유)가 기록 길이를 꼭짓점과 맞춤 — [저장] 400 막음 - nodeRecord · nodeOff(길이 1 cm · 기울기 0.1 % 넘게 어긋남) — Span.ts(Plan 700 줄 넘지 않게) · 598 노드 판이 씀 - 시험 599_3 에 기록 따라감 · 어긋남 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,10 +41,11 @@ import {
|
||||
removeLine,
|
||||
reverseLine,
|
||||
samePoint,
|
||||
type NodeRecord,
|
||||
type PlanNetwork,
|
||||
type Vertex,
|
||||
} from "./logic/D03_PlanAnalysis_Plan";
|
||||
import { replaceSpan, respanBlocked } from "./logic/D03_PlanAnalysis_Span";
|
||||
import { nodeRecord, replaceSpan, respanBlocked } from "./logic/D03_PlanAnalysis_Span";
|
||||
import {
|
||||
fmt,
|
||||
lineAt,
|
||||
@@ -122,8 +123,14 @@ export function createPlanDraw(params: PlanDrawParams): PlanDraw {
|
||||
let kind: DrawConstraint = "free";
|
||||
let lengthM = DRAW_DEFAULT_LENGTH_M;
|
||||
let slopePct = DRAW_DEFAULT_SLOPE_PCT;
|
||||
// 다시 긋기 — 선 id · 앞 · 뒤 꺾임점 · 새로 찍은 속 점
|
||||
let span: { line: string; from: number; to: number; through: Vertex[] } | null = null;
|
||||
// 다시 긋기 — 선 id · 앞 · 뒤 꺾임점 · 새로 찍은 속 점 · 그 기록
|
||||
let span: {
|
||||
line: string;
|
||||
from: number;
|
||||
to: number;
|
||||
through: Vertex[];
|
||||
records: NodeRecord[];
|
||||
} | null = null;
|
||||
const spanLine = (): number =>
|
||||
span ? params.network().lines.findIndex((line) => line.id === span!.line) : -1;
|
||||
|
||||
@@ -272,7 +279,7 @@ export function createPlanDraw(params: PlanDrawParams): PlanDraw {
|
||||
return false;
|
||||
}
|
||||
setMode("draw");
|
||||
span = { line: lineId, from, to, through: [] };
|
||||
span = { line: lineId, from, to, through: [], records: [] };
|
||||
panelState();
|
||||
params.onMode();
|
||||
return true;
|
||||
@@ -381,9 +388,22 @@ export function createPlanDraw(params: PlanDrawParams): PlanDraw {
|
||||
showToast(preview.note ?? "여기에는 점을 찍을 수 없습니다.", "info");
|
||||
return false;
|
||||
}
|
||||
// 노드 기록 = 그때 방식 · 값(붙은 점 = 자유 · 599-2)
|
||||
const record = preview.snapped ? nodeRecord("free", 0, 0) : nodeRecord(kind, lengthM, slopePct);
|
||||
if (span) {
|
||||
if (!preview.snapped) return (span.through.push(preview.point), true);
|
||||
const next = replaceSpan(params.network(), spanLine(), span.from, span.to, span.through);
|
||||
if (!preview.snapped) {
|
||||
span.through.push(preview.point);
|
||||
span.records.push(record);
|
||||
return true;
|
||||
}
|
||||
const next = replaceSpan(
|
||||
params.network(),
|
||||
spanLine(),
|
||||
span.from,
|
||||
span.to,
|
||||
span.through,
|
||||
span.records,
|
||||
);
|
||||
if (typeof next === "string") showToast(next, "info");
|
||||
else params.commit(next);
|
||||
span = null;
|
||||
@@ -396,7 +416,7 @@ export function createPlanDraw(params: PlanDrawParams): PlanDraw {
|
||||
let next = params.network();
|
||||
if (preview.onLine)
|
||||
next = insertVertex(next, preview.onLine.line, preview.onLine.segment, preview.point);
|
||||
params.commit(appendVertex(next, line, preview.point));
|
||||
params.commit(appendVertex(next, line, preview.point, record));
|
||||
if (ended) {
|
||||
showToast(`${preview.note ?? "붙음"} — 긋기 끝`, "success");
|
||||
setMode("idle");
|
||||
@@ -494,6 +514,7 @@ export function createPlanDraw(params: PlanDrawParams): PlanDraw {
|
||||
return true;
|
||||
}
|
||||
if (mode === "draw" && span && keyIs(event, "plan.drawBack")) {
|
||||
span.records.pop();
|
||||
if (!span.through.pop()) setMode("idle");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user