From 91f843b5bb04afbc5ca248a46e93c92d033ac35f Mon Sep 17 00:00:00 2001 From: umsangdon Date: Sun, 23 Aug 2026 18:50:19 +0900 Subject: [PATCH] =?UTF-8?q?fix(B06):=20=ED=91=9C=EA=B3=A0(Y)=20=EB=88=88?= =?UTF-8?q?=EA=B8=88=20=EC=B5=9C=EC=86=8C=20=EB=8B=A8=EC=9C=84=201m?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 확대하면 0.5m·0.2m 눈금까지 내려가 도면에서 읽을 일 없는 값이 표기됐다 (2026-08-23 사용자 지시). 횡단·종단 모두 표고 눈금 간격을 1m로 하한을 둔다 — 라벨은 항상 정수. 편거리(X) 눈금은 종전대로. 자체검증: node tmp/tests/test_cross_y_ticks.mjs (모든 눈금 정수·간격 1m 이상), test_cross_axes_zoom.mjs 재실행, tsc --noEmit 통과. Co-Authored-By: Claude Opus 5 (1M context) --- B06_Section/B06_Section_UI_Cross_Axes.ts | 11 +++++++---- B06_Section/B06_Section_UI_Longitudinal.ts | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/B06_Section/B06_Section_UI_Cross_Axes.ts b/B06_Section/B06_Section_UI_Cross_Axes.ts index cccbf371..f7e5d72b 100644 --- a/B06_Section/B06_Section_UI_Cross_Axes.ts +++ b/B06_Section/B06_Section_UI_Cross_Axes.ts @@ -33,6 +33,8 @@ const X_LABEL_MIN_PX = 48; /** Y 눈금 라벨이 겹치지 않는 최소 간격(px). */ const Y_LABEL_MIN_PX = 14; const X_TARGET_TICKS = 7; +/** 표고(Y) 눈금 최소 간격(m) — 1m 아래 단위는 표기하지 않는다. */ +const MIN_ELEVATION_STEP_M = 1; const Y_TARGET_TICKS = 10; /** @@ -99,10 +101,11 @@ export function createCrossAxes( const rawTop = toRaw(displayAt(plotTop)); const rawBottom = toRaw(displayAt(plotBottom)); const rawSpan = rawTop - rawBottom; - const yStep = niceTickStep( - rawSpan, - Y_TARGET_TICKS, - Math.floor((plotBottom - plotTop) / Y_LABEL_MIN_PX), + // 표고 눈금은 **1m 아래로 내려가지 않는다**(2026-08-23 사용자 지시) — 0.5m 표기는 + // 도면에서 읽을 일이 없다. 확대해도 1m 간격까지만 촘촘해진다. + const yStep = Math.max( + niceTickStep(rawSpan, Y_TARGET_TICKS, Math.floor((plotBottom - plotTop) / Y_LABEL_MIN_PX)), + MIN_ELEVATION_STEP_M, ); const yDecimals = Math.max(0, Math.ceil(-Math.log10(yStep) - 1e-9)); for (let raw = Math.ceil(rawBottom / yStep) * yStep; raw <= rawTop + 1e-9; raw += yStep) { diff --git a/B06_Section/B06_Section_UI_Longitudinal.ts b/B06_Section/B06_Section_UI_Longitudinal.ts index dd8208c1..4599b034 100644 --- a/B06_Section/B06_Section_UI_Longitudinal.ts +++ b/B06_Section/B06_Section_UI_Longitudinal.ts @@ -220,7 +220,8 @@ export function createLongitudinalProfile( const rawSpan = elevationSpan / exaggeration; const rawTop = elevationMid + rawSpan / 2; // 라벨 글자(최대 13px, sticky 축)가 겹치지 않게 눈금 간격은 16px 이상 띄운다. - const tickStep = niceTickStep(rawSpan, 10, Math.floor(plotHeight / 16)); + // 표고 눈금은 1m 아래로 내려가지 않는다(2026-08-23 사용자 지시). + const tickStep = Math.max(niceTickStep(rawSpan, 10, Math.floor(plotHeight / 16)), 1); const tickDecimals = Math.max(0, Math.ceil(-Math.log10(tickStep) - 1e-9)); for ( let value = Math.ceil((elevationMid - rawSpan / 2) / tickStep) * tickStep;