From 3de262a4a9a9bcf98cd0659c3f2b2c15c6b2efdd Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sat, 31 Oct 2026 22:28:41 +0900 Subject: [PATCH] =?UTF-8?q?fix(D03=20=EA=B8=8B=EA=B8=B0):=20=EB=86=93?= =?UTF-8?q?=EC=9D=B8=20=EB=85=B8=EB=93=9C=20+/=E2=88=92=20=EC=83=89=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EA=B2=8C=20=E2=80=94=20=EC=84=A0=EB=B3=B4?= =?UTF-8?q?=EB=8B=A4=20=EA=B5=B5=EC=9D=80=20=EB=B6=80=ED=98=B8=20=EC=83=89?= =?UTF-8?q?=20=EC=A0=90=20+=20=EA=B2=80=EC=9D=80=20=ED=85=8C=20=C2=B7=20?= =?UTF-8?q?=EA=B3=A0=EB=A5=B8=20=EC=84=A0=EC=9D=80=20=EB=85=B8=EB=9E=91=20?= =?UTF-8?q?=EA=B0=95=EC=A1=B0=20=EC=9C=84=EC=97=90=20=EC=A0=90=20=EB=8B=A4?= =?UTF-8?q?=EC=8B=9C=20=C2=B7=20=EC=86=90=EC=9E=A1=EC=9D=B4=20=3D=20?= =?UTF-8?q?=EB=B9=88=20=EB=84=A4=EB=AA=A8=20(PLAN=20625-3=20=C2=B7=20?= =?UTF-8?q?=EC=9A=94=EA=B5=AC=20535-2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 까닭 — 놓인 점 반지름 3 px · 테 없음 = − 하늘(#29e0ff)이 노선 민트 선(#3df5c4)에 묻힘 · 고른 선은 흰 네모 손잡이와 노랑 강조(8 px)가 점을 덮음. - DrawPaint `paintNodes` 떼어 냄(점 5 px · fillCased) · Edit 가 고른 선만 강조 위에 다시 그림(heightAt 인자 덧) - 시험 test_625_draw 놓인 노드 지킴 하나 덧 Co-Authored-By: Claude Opus 5.5 --- .../D03_PlanAnalysis_UI_DrawPaint.ts | 31 +++++++++++++------ D03_PlanAnalysis/D03_PlanAnalysis_UI_Edit.ts | 22 +++++++------ D03_PlanAnalysis/D03_PlanAnalysis_UI_Page.ts | 1 + resources/tester/test_625_draw.py | 16 ++++++++++ 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/D03_PlanAnalysis/D03_PlanAnalysis_UI_DrawPaint.ts b/D03_PlanAnalysis/D03_PlanAnalysis_UI_DrawPaint.ts index c584139bd..473c58f78 100644 --- a/D03_PlanAnalysis/D03_PlanAnalysis_UI_DrawPaint.ts +++ b/D03_PlanAnalysis/D03_PlanAnalysis_UI_DrawPaint.ts @@ -36,6 +36,8 @@ import type { DrawPreview } from "./D03_PlanAnalysis_UI_Draw"; export const SNAP_PX = 12; /** 선 위 누름으로 볼 반경(px). */ export const LINE_HIT_PX = 8; +/** 놓인 꺾임점 점 반지름(px) — 선 테(3 + 4 px)보다 굵게 · 고른 선 손잡이는 이 점을 감싸는 빈 네모. */ +export const NODE_DOT_PX = 5; /** 구간 길이 라벨을 보일 화면 길이(px). */ const LABEL_MIN_PX = 70; @@ -213,24 +215,33 @@ export function paintNetwork( ); if (map.slopes) segmentLabels(context, map, line.vertices, z); }); - // 꺾임점 = 들어온 구간 기울기 부호 색(625-2 B4) · 기록과 어긋난 노드(옮김) = 경고 고리(599-2) - context.strokeStyle = colors.warn; - context.lineWidth = 2; - for (const line of network.lines) + paintNodes(context, map, network.lines, z); + drawPieces(context, map, network); + extra(); +} + +/** 꺾임점 = 들어온 구간 기울기 부호 색(625-2 B4) · 선보다 굵은 점 + 검은 테 = 선 색 · 위성 위에서도 가름(625-3) · + * 기록과 어긋난 노드(옮김) = 경고 고리(599-2) · 고른 선은 고름 강조 위에 다시 그림(`D03_PlanAnalysis_UI_Edit`). */ +export function paintNodes( + context: CanvasRenderingContext2D, + map: Pick, + lines: ReadonlyArray, + z: HeightAt, +): void { + for (const line of lines) line.vertices.forEach((v, i) => { if (!i) return; const [sx, sy] = map.toScreen(v); context.beginPath(); - context.arc(sx, sy, 3, 0, Math.PI * 2); - context.fillStyle = slopeColor(groundSlopePct(line.vertices[i - 1], v, z)); - context.fill(); + context.arc(sx, sy, NODE_DOT_PX, 0, Math.PI * 2); + fillCased(context, slopeColor(groundSlopePct(line.vertices[i - 1], v, z))); if (!nodeOff(line, i, z)) return; context.beginPath(); - context.arc(sx, sy, 7, 0, Math.PI * 2); + context.arc(sx, sy, NODE_DOT_PX + 4, 0, Math.PI * 2); + context.lineWidth = 2; + context.strokeStyle = planColors().warn; context.stroke(); }); - drawPieces(context, map, network); - extra(); } /** 지점 핀 겹(585-1) — 꼭지 = 지점 · 둥근 머리 · 「지점 N」 · 화면 px 고정 크기 · 돌린 지도에서도 섬. */ diff --git a/D03_PlanAnalysis/D03_PlanAnalysis_UI_Edit.ts b/D03_PlanAnalysis/D03_PlanAnalysis_UI_Edit.ts index 4feb44586..43c33632b 100644 --- a/D03_PlanAnalysis/D03_PlanAnalysis_UI_Edit.ts +++ b/D03_PlanAnalysis/D03_PlanAnalysis_UI_Edit.ts @@ -20,7 +20,7 @@ import { showToast } from "@ui/ui_template_elements"; import { themeColor } from "@ui/ui_template_palette"; import { keyIs } from "../A00_Common/key_registry"; -import { distanceAlong, pointAtDistance } from "./logic/D03_PlanAnalysis_Draw"; +import { distanceAlong, pointAtDistance, type HeightAt } from "./logic/D03_PlanAnalysis_Draw"; import { insertVertex, moveMark, @@ -46,7 +46,9 @@ import { } from "./logic/D03_PlanAnalysis_Select"; import { lineAt, + NODE_DOT_PX, paintMark, + paintNodes, planLabel, screenGap, SNAP_PX, @@ -70,6 +72,8 @@ export interface PlanEditParams { /** 지점(긋기에 붙는 점 · 591-2). */ base: () => Vertex[]; commit: (next: PlanNetwork) => void; + /** 원지반 높이(고른 선 꺾임점 부호 색 · 625-3). */ + heightAt: () => HeightAt; /** 끌기 중 — 화면만 바꿈(되돌리기 · 캐시 없음). */ show: (next: PlanNetwork) => void; /** 지점 자리 노드를 끎 — 지점 · 노선 한 걸음 · 화면만. */ @@ -329,18 +333,18 @@ export function createPlanEdit(params: PlanEditParams): PlanEdit { context.stroke(); strokeCased(context, colors.active, PICK_LINE_PX); } - // 꺾임점 손잡이(고른 것이 든 선) + // 꺾임점 손잡이(고른 것이 든 선) = 부호 색 점(고름 강조 위에 다시) + 감싸는 빈 네모(625-3) const lines = pickedLines(network); - context.lineWidth = 2; - context.fillStyle = "#ffffff"; - for (const line of network.lines) { - if (!lines.has(line.id)) continue; + const handled = network.lines.filter((line) => lines.has(line.id)); + paintNodes(context, map, handled, params.heightAt()); + const half = NODE_DOT_PX + 3; + for (const line of handled) for (const point of line.vertices) { const [sx, sy] = map.toScreen(point); - context.fillRect(sx - 4, sy - 4, 8, 8); - context.strokeRect(sx - 4, sy - 4, 8, 8); + context.beginPath(); + context.rect(sx - half, sy - half, half * 2, half * 2); + strokeCased(context, colors.active, 2); } - } // 고른 노드 · 마크 테 const node = picked?.kind === "node" ? picked.node : null; const nodePoint = node diff --git a/D03_PlanAnalysis/D03_PlanAnalysis_UI_Page.ts b/D03_PlanAnalysis/D03_PlanAnalysis_UI_Page.ts index 48689d050..77b3e017a 100644 --- a/D03_PlanAnalysis/D03_PlanAnalysis_UI_Page.ts +++ b/D03_PlanAnalysis/D03_PlanAnalysis_UI_Page.ts @@ -146,6 +146,7 @@ export async function renderD03PlanAnalysis(root: HTMLElement): Promise { network: () => network, base: () => points, commit, + heightAt: () => z, show: (next) => { network = normalizePieces(next, yearStart); map.redraw(); diff --git a/resources/tester/test_625_draw.py b/resources/tester/test_625_draw.py index c0822d833..3bdb02a28 100644 --- a/resources/tester/test_625_draw.py +++ b/resources/tester/test_625_draw.py @@ -159,3 +159,19 @@ def test_가파른_땅_지형_밖_고를_자리_없음(r): for key in ("steep", "offTerrain"): f = r[key] assert not f["flat"] and not f["nodes"] and not f["arcs"] + + +def test_놓인_노드_부호_색_선_위_고름_위에도_보임(): + """625-3 — 놓인 꺾임점 = 선 테(3 + 4 px)보다 굵은 부호 색 점 + 검은 테 · 고른 선은 노랑 강조 위에 점을 다시 그리고 손잡이 = 빈 네모.""" + paint = (ROOT / "D03_PlanAnalysis" / "D03_PlanAnalysis_UI_DrawPaint.ts").read_text( + encoding="utf-8" + ) + edit = (ROOT / "D03_PlanAnalysis" / "D03_PlanAnalysis_UI_Edit.ts").read_text(encoding="utf-8") + assert int(re.search(r"NODE_DOT_PX = (\d+)", paint).group(1)) * 2 > 3 + 4 + body = paint[paint.index("export function paintNodes") :] + body = body[: body.index("\n}\n")] + assert "fillCased(context, slopeColor(groundSlopePct(" in body + assert "paintNodes(context, map, network.lines, z)" in paint + draw = edit[edit.index("draw(context, map) {") :] + assert draw.index("sel.paths()") < draw.index("paintNodes(") < draw.index("context.rect(") + assert "fillRect" not in draw[: draw.index("고른 노드 · 마크 테")]