Files
Aislo/B07_DesignDetail/openwebcad/src/tools/draw/draw-steps.ts
T
eomsangdonandClaude Opus 5.5 3cebb37ed0 feat(CAD): 337-3a 나-1 그리기 8 — 오토캐드 물음 차례 · 옵션 · 기본값 · 빈 Enter · Esc · 끝난 뒤
- LINE: 「첫 번째 점 지정」 빈 Enter = 마지막 끝점에서 이음 · U = 마지막 토막(되돌림 한 칸) · 둘째 토막부터 C · Enter · Esc = 끝(토막 남음)
- PLINE(새 pline-tool): 호(A) 접선 호 · 길이(L) · 닫기(C · 호 모드 CL) · 명령 취소(U) · 선(L) · Esc · Enter = 그린 데까지 남김
- RECTANG: 치수(D) 길이 · 폭 기억(RECT.L · RECT.W) → 누른 쪽 사분면 · 없는 옵션 안내
- CIRCLE: 3P · 2P · 지름(D) <2r> · 반지름 기억(CIRCLERAD · 처음 <> 없음) · 한 번 뒤 끝
- POLYGON(새 polygon-tool): 변 수 기억 <4> · 3~1024 정수 · 모서리(E) · 내접/외접 기억 · 숫자 = 아래 변 수평
- ARC(새 arc-tool): 세 점 · 중심(C) · 각도(A) · 끝(E) · 반지름(R)
- ELLIPSE(새 ellipse-tool): 축 두 끝 · 중심(C) · 회전(R) · 다른 축 숫자 = 중심에서 반 길이(N10)
- SPLINE: 다음 점 입력 · U · 넷째 점부터 C · Esc 버림 · DONUT 중심 되풀이(loopFrom)
- 시험 draw-acad 22 · keyboard-chain 옛 선 · 폴리선 줄 두 곳 새 동작으로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VmC34fsxxbweEG3RUjs3Mn
2026-10-16 00:16:15 +09:00

40 lines
1.6 KiB
TypeScript

/**
* 손으로 짠 그리기 도구 공용(337 설계 2-14) — 점 물음 사건 · 옵션 한 줄 · 끝 상태 · 마지막 그린 끝점(LINE.END).
* 선 · 폴리선 · 원 · 사각형 · 다각형 · 타원이 같이 씀.
*/
import { Point } from '@flatten-js/core';
import { type OptionSpec, type XY, recall, remember } from '../../commands/prompt';
import { END_STATE } from '../tool.types';
/** 옵션 하나 — 그림 「label(kw)」 · 사건 `OPTION.<key>` · 맞추기 kw · en */
export const option = (key: string, kw: string, label: string, en = key): OptionSpec => ({
key,
kw,
en,
label,
});
/** 첫 점 물음(기준점 없음) — 누름 · 절대 좌표만 */
export const firstPointEvents = (actions: string | string[], target: string) => ({
MOUSE_CLICK: { actions, target },
ABSOLUTE_POINT_INPUT: { actions, target },
});
/** 기준점 있는 점 물음 — 누름 · 절대 · 상대 · 거리 숫자 */
export const pointEvents = (actions: string | string[], target: string) => ({
...firstPointEvents(actions, target),
RELATIVE_POINT_INPUT: { actions, target },
NUMBER_INPUT: { actions, target },
});
/** 명령 끝 상태 — 들면 쉬는 상태(선택 도구)로 */
export const END = { [END_STATE]: { type: 'final' as const } };
// 마지막 선 · 폴리선 · 호 끝점 — LINE · PLINE 첫 점 빈 Enter 가 여기서 이어 그림(오토캐드)
const LINE_END = 'LINE.END';
export const rememberDrawEnd = (point: XY): void => remember(LINE_END, { x: point.x, y: point.y });
export const lastDrawEnd = (): Point | null => {
const point = recall<XY>(LINE_END);
return point ? new Point(point.x, point.y) : null;
};