feat(CAD): 331-4 동적 입력 — 커서 옆 길이 · 각도 두 칸 · Tab 잠금

- 기준점 있는 점 단계에서만 Tab 가로챔(그 밖은 브라우저 초점 이동) · 숫자 넣고 Tab = 그 칸 잠금 + 다음 칸 · 빈 Tab = 칸만 바꿈
- 각도 칸 잠금 = 각도 고정 · 길이 잠근 채 Enter = 그 길이 · `100` Tab `30` Enter → (86.603, 50)
- 커서 옆 줄 `▸[길이 100 🔒] [각도 30_]` — 잠금 🔒 · 지금 칸 ▸ · 나머지는 기준점→커서 실측
- 한 점 · Esc · 새 명령이면 각도 고정 · 길이 잠금 모두 풂(releaseOnePoint)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
This commit is contained in:
2026-10-15 12:44:23 +09:00
co-authored by Claude Opus 5.5
parent ca11ee1456
commit 309be22ce0
5 changed files with 177 additions and 17 deletions
@@ -84,3 +84,27 @@ export function drawInputField(
);
});
}
/**
* 동적 입력 두 칸 — `[길이 100 🔒] ▸[각도 30_]`. 잠근 칸은 🔒 · 지금 칸은 ▸ + 친 글 ·
* 나머지는 기준점→커서 실측(각도 = 동쪽 0° 반시계 +).
*/
export function dynamicInputLine(
base: Point,
mouse: Point,
field: 'length' | 'angle',
typing: string,
lockedLength: number | null,
lockedDegrees: number | null
): string {
const live = {
length: Math.hypot(mouse.x - base.x, mouse.y - base.y),
angle: ((Math.atan2(mouse.y - base.y, mouse.x - base.x) * 180) / Math.PI + 360) % 360,
};
const cell = (name: 'length' | 'angle', label: string, locked: number | null) => {
const active = field === name;
const value = active && typing ? `${typing}_` : (locked ?? Number(live[name].toFixed(2)));
return `${active ? '▸' : ' '}[${label} ${value}${locked !== null ? ' 🔒' : ''}]`;
};
return `${cell('length', '길이', lockedLength)} ${cell('angle', '각도', lockedDegrees)}`;
}