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
@@ -1,5 +1,6 @@
/**
* 한 번 스냅 — 점 단계에서 END · MID · CEN · INT · PER · NEA · NON 을 치면 다음 한 점만 그 스냅(오토캐드).
* 한 번 스냅 — 점 단계에서 END · MID · CEN · QUA · INT · PER · NEA · NOD · NON 을 치면 다음 한 점만 그 스냅(오토캐드).
* 이름 = 앞 세 글자 ~ 영문 전체(END · ENDP · ENDPOINT) · 우리에 없는 스냅(TAN · EXT …)은 안내.
* F3(객체 스냅) 꺼져 있어도 먹음. 커서 둘레에 맞는 점이 없으면 클릭을 버리고 기다림 · Esc 로 풂.
*/
import type { Point } from '@flatten-js/core';
@@ -14,9 +15,11 @@ const SNAP_LABELS = {
END: '끝점',
MID: '중간점',
CEN: '중심',
QUA: '사분점',
INT: '교차점',
PER: '수직',
NEA: '근처점',
NOD: '노드',
NON: '스냅 없음',
} as const;
type SnapName = keyof typeof SNAP_LABELS;
@@ -25,15 +28,52 @@ const SNAP_TYPES: Partial<Record<SnapName, SnapPointType>> = {
END: SnapPointType.LineEndPoint,
MID: SnapPointType.LineMidPoint,
CEN: SnapPointType.CircleCenter,
QUA: SnapPointType.CircleCardinal,
NOD: SnapPointType.Point,
};
/** 오토캐드 영문 전체 이름 — 세 글자 줄임부터 받음 */
const FULL_NAMES: Record<SnapName, string> = {
END: 'ENDPOINT',
MID: 'MIDPOINT',
CEN: 'CENTER',
QUA: 'QUADRANT',
INT: 'INTERSECTION',
PER: 'PERPENDICULAR',
NEA: 'NEAREST',
NOD: 'NODE',
NON: 'NONE',
};
/** 오토캐드엔 있고 우리엔 없는 스냅 */
const ABSENT_NAMES: Record<string, string> = {
TAN: 'TANGENT',
EXT: 'EXTENSION',
INS: 'INSERTION',
APP: 'APPINT',
PAR: 'PARALLEL',
GCE: 'GCEN',
};
const byName = <K extends string>(table: Record<K, string>, text: string): K | null => {
const typed = text.trim().toUpperCase().replace(/^_/, '');
if (typed.length < 3) return null;
const hit = (Object.keys(table) as K[]).find(
(short) => typed.startsWith(short) && table[short].startsWith(typed)
);
return hit ?? null;
};
/** 친 글 → 스냅 이름(END · ENDP · ENDPOINT → END) · 아니면 null */
export const snapName = (text: string): SnapName | null => byName(FULL_NAMES, text);
/** 우리에 없는 오토캐드 스냅 이름(세 글자 꼴) · 아니면 null */
export const absentSnapName = (text: string): string | null => byName(ABSENT_NAMES, text);
let override: SnapName | null = null;
export const getSnapOverride = (): SnapName | null => override;
export const setSnapOverride = (name: SnapName | null) => {
override = name;
};
export const isSnapName = (text: string): text is SnapName => text in SNAP_LABELS;
export const isSnapName = (text: string): text is SnapName => snapName(text) === text;
/** 커서 옆 안내 줄 */
export const snapOverrideHint = (): string | null =>