feat(CAD): 337-1 가-2 점 물음 보조 · ↑↓ 기록 · Tab 후보 — FROM · M2P · @ · # · * · 스냅 이름 늘림 · H11

- 새 inputController/input-history.ts — 쉴 때 = 친 명령 기록 · 명령 중 = 그 물음 최근 값 20 · 알림 줄 안 섞음(H11) · 후보 돌림
- 새 inputController/point-modifiers.ts — FROM(기준점 → <간격띄우기>) · M2P/MTP · @ = 마지막 점 · #·* 절대 좌표 · 스냅 이름
- 스냅 이름 — 세 글자 ~ 영문 전체(END · ENDP · ENDPOINT) · QUA · NOD 더함 · TAN · EXT · INS · APP · PAR · GCE 는 「이 CAD 에 없음」 안내(N14)
- 사다리 — 기준점 없는 첫 점 @dx,dy = 마지막 점 기준 · 옵션 영문 전체 딱 맞음은 옵션 먼저(CENTER) · 줄임은 스냅(CEN) · 덧물음 base
- ↑↓ = 기록 · 후보 · Shift+↑↓ = 화면 옮김 · Tab(쉼 + 친 글) = 후보 돌림 · 명령행도 같은 함수
- 시험 — prompt-frame 가-2 8 · keyboard-chain PLINE 첫 점 줄 손질

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QfHKQs7J3hQELKMWQMUJEy
This commit is contained in:
2026-10-16 00:04:30 +09:00
co-authored by Claude Opus 5.5
parent 83e246deb4
commit 8661501dae
8 changed files with 447 additions and 47 deletions
@@ -49,13 +49,16 @@ import {
parsePointText,
type PointTextEvent,
} from './input-patterns';
import { isSnapName, setSnapOverride } from './input-snap-override';
import { setSnapOverride } from './input-snap-override';
import { tryPointModifier } from './point-modifiers';
// ---- 덧물음(설계 2-11) ----
export interface SubPrompt {
prompt: PromptSpec;
kind: StepKind;
/** 상대 좌표 · 거리의 기준(FROM 간격띄우기 · M2P 둘째 점) — 없으면 지금 기준점 */
base?: Point;
onPoint?(p: Point): SubResult;
onNumber?(n: number): SubResult;
onOption?(key: string): SubResult;
@@ -75,9 +78,11 @@ export const closeSubPrompt = (): void => {
subs.length = 0;
};
function settle(result: SubResult | undefined) {
/** 덧물음 sub 의 답 — 'done' · {point} 면 그 덧물음만 닫음(답 안에서 다음 덧물음을 열어도 됨) */
function settle(sub: SubPrompt, result: SubResult | undefined) {
if (!result || result === 'stay') return;
subs.pop();
const at = subs.lastIndexOf(sub);
if (at >= 0) subs.splice(at, 1);
if (result !== 'done') sendPoint({ type: ActorEvent.ABSOLUTE_POINT_INPUT, value: result.point });
}
@@ -181,21 +186,32 @@ export const distanceEvent = (value: number): PointTextEvent => ({
export const dynamicInputApplies = (): boolean =>
currentPrompt().kind === 'point' && !!getAngleGuideOriginPoint();
/** base 에서 to 쪽으로 distance 간 점 */
const toward = (base: Point, to: Point, distance: number): Point => {
const length = Math.hypot(to.x - base.x, to.y - base.y) || 1;
return new Point(
base.x + ((to.x - base.x) / length) * distance,
base.y + ((to.y - base.y) / length) * distance
);
};
/** 점 하나 — 덧물음 먼저(마우스 누름도) · 각도 고정 · 한 번 스냅은 이 한 점으로 끝 */
export function sendPoint(event: PointTextEvent | MouseClickEvent): void {
const sub = subPrompt();
if (sub) {
const last = lastPoint();
const base = sub.base ?? getAngleGuideOriginPoint() ?? (last && new Point(last.x, last.y));
if (event.type === ActorEvent.NUMBER_INPUT) {
if (sub.onNumber) settle(sub.onNumber(event.value));
if (sub.onNumber) settle(sub, sub.onNumber(event.value));
else if (base) settle(sub, sub.onPoint?.(toward(base, event.worldMouseLocation, event.value)));
else reject(currentPrompt());
} else if (event.type === ActorEvent.MOUSE_CLICK) {
settle(sub.onPoint?.(event.worldMouseLocation));
settle(sub, sub.onPoint?.(event.worldMouseLocation));
} else if (event.type === ActorEvent.RELATIVE_POINT_INPUT) {
const base = getAngleGuideOriginPoint() ?? lastPoint();
if (base) settle(sub.onPoint?.(new Point(base.x + event.value.x, base.y + event.value.y)));
if (base) settle(sub, sub.onPoint?.(new Point(base.x + event.value.x, base.y + event.value.y)));
else reject(currentPrompt());
} else {
settle(sub.onPoint?.(event.value));
settle(sub, sub.onPoint?.(event.value));
}
} else {
getActiveToolActor()?.send(event);
@@ -206,13 +222,13 @@ export function sendPoint(event: PointTextEvent | MouseClickEvent): void {
function sendOption(key: string) {
const sub = subPrompt();
if (sub) settle(sub.onOption?.(key));
if (sub) settle(sub, sub.onOption?.(key));
else send({ type: `OPTION.${key}` });
}
function sendEnter() {
const sub = subPrompt();
if (sub) settle(sub.onEnter?.());
if (sub) settle(sub, sub.onEnter?.());
else send({ type: ActorEvent.ENTER });
}
@@ -275,7 +291,8 @@ function routeEmpty(prompt: CurrentPrompt) {
if (fallback?.kind === 'value') {
const value = defaultValue(fallback);
if (typeof value === 'number') {
if (subPrompt()?.onNumber) settle(subPrompt()?.onNumber?.(value));
const sub = subPrompt();
if (sub?.onNumber) settle(sub, sub.onNumber(value));
else sendPoint(distanceEvent(value));
return;
}
@@ -316,12 +333,7 @@ function routePointAid(text: string): boolean {
setAngleLock(Number.parseFloat(lock[1]));
return true;
}
const upper = normalizeKeyword(text);
if (isSnapName(upper)) {
setSnapOverride(upper);
return true;
}
return false;
return tryPointModifier(text); // 스냅 이름 · FROM · M2P · @ · # · *
}
/** ④ 좌표 · 거리 */
@@ -329,6 +341,13 @@ function routePointText(text: string, prompt: CurrentPrompt) {
const event = parsePointText(text, distanceCursor);
if (!event) return reject(prompt);
const hasBase = !!getAngleGuideOriginPoint() || !!subPrompt();
if (event.type === ActorEvent.RELATIVE_POINT_INPUT && !hasBase) {
// 기준점 없는 첫 점 `@dx,dy` = 마지막 점(LASTPOINT) 기준
const last = lastPoint();
if (!last) return reject(prompt);
const value = new Point(last.x + event.value.x, last.y + event.value.y);
return sendPoint({ type: ActorEvent.ABSOLUTE_POINT_INPUT, value });
}
if (event.type !== ActorEvent.ABSOLUTE_POINT_INPUT && !hasBase) return reject(prompt);
if (event.type === ActorEvent.NUMBER_INPUT) {
const problem = numberProblem(event.value, prompt.spec?.number);
@@ -344,7 +363,7 @@ function routeNumber(text: string, prompt: CurrentPrompt) {
const problem = numberProblem(value, prompt.spec?.number);
if (problem) return reject(prompt, problem);
const sub = subPrompt();
if (sub) settle(sub.onNumber?.(value));
if (sub) settle(sub, sub.onNumber?.(value));
else send({ type: ActorEvent.NUMBER_INPUT, value, worldMouseLocation: distanceCursor() });
}
@@ -365,9 +384,12 @@ export function routeTyped(raw: string): void {
else notice(`알 수 없는 명령 「${normalizeKeyword(text)}」.`);
return;
}
if (prompt.kind === 'point' && routePointAid(text)) return;
// ⑤ 옵션(숨김 포함) · 없는 옵션 안내
const hit = matchOption(text, prompt.spec);
// 옵션 kw · 영문 전체와 딱 같으면 옵션 먼저(ARC 「CENTER」) · 줄임은 스냅 먼저(「CEN」 = 스냅)
const exact =
hit && 'option' in hit && [hit.option.kw, hit.option.en].includes(normalizeKeyword(text));
if (prompt.kind === 'point' && !exact && routePointAid(text)) return;
// ⑤ 옵션(숨김 포함) · 없는 옵션 안내
if (hit && 'option' in hit) return sendOption(hit.option.key);
if (hit && 'absent' in hit) {
notice(`「${hit.absent.label}(${hit.absent.kw})」 옵션은 이 CAD 에 없음.`);