feat(CAD): 331-3 선 중 닫기(C) · 명령취소(U) · 한 번 스냅 이름 · 한글 안내문
- 선 — 이어 그리기 첫 점 · 구간 기억 · C = 둘째 선부터 첫 점으로 닫고 끝 · U = 마지막 한 구간만 취소 - 점 단계 글 — 선택지 글자(meta.options)만 도구로 · 나머지는 명령 이름 그대로 · 한글 받개는 점 단계에서 안 잡음 - 새 input-snap-override — END · MID · CEN · INT · PER · NEA · NON 다음 한 점만 · F3 꺼져도 · 맞는 점 없으면 클릭 버림 · Esc 풂 · 커서 옆 안내 - 원본 도구 안내문 한글(선 · 원 · 사각형 · 이동 · 복사 · 회전 · 배열 · 정렬 · 지우개 · 그림 · 폴리선 합치기 · 선택) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013QyNXY2TUKXCFMwAca2APG
This commit is contained in:
@@ -17,6 +17,7 @@ import { getClosestSnapPointWithinRadius } from '../helpers/get-closest-snap-poi
|
||||
import { pickRadius } from '../helpers/pick-radius.ts';
|
||||
import {
|
||||
getActiveToolActor,
|
||||
getAngleGuideOriginPoint,
|
||||
getAngleStep,
|
||||
getCanvas,
|
||||
getPickableEntities,
|
||||
@@ -46,8 +47,10 @@ import { Tool } from '../tools.ts';
|
||||
import { SelectState, selectToolStateMachine } from '../tools/select-tool.ts';
|
||||
import { ActorEvent, type MouseClickEvent, type TextInputEvent } from '../tools/tool.types.ts';
|
||||
import {
|
||||
activeToolAcceptsText,
|
||||
activeToolTakesText,
|
||||
activeToolWantsFreeText,
|
||||
activeToolWantsIme,
|
||||
activeToolWantsPoint,
|
||||
ImeSink,
|
||||
isImeKey,
|
||||
isPlainSpace,
|
||||
@@ -58,6 +61,13 @@ import { wheelZoom } from './input-wheel.ts';
|
||||
import { attachTouch } from './input-touch.ts';
|
||||
import { ANGLE_LOCK_REGEXP, parsePointText, type PointTextEvent } from './input-patterns.ts';
|
||||
import { angleLockHint, setAngleLock } from './input-angle-lock.ts';
|
||||
import {
|
||||
getSnapOverride,
|
||||
isSnapName,
|
||||
setSnapOverride,
|
||||
snapOverrideHint,
|
||||
snapOverridePoint,
|
||||
} from './input-snap-override.ts';
|
||||
|
||||
/** 이만큼 넘게 끌면 클릭이 아니라 드래그로 본다 (화면 픽셀) */
|
||||
const DRAG_SELECT_MIN_PX = 4;
|
||||
@@ -112,7 +122,7 @@ export class InputController {
|
||||
}
|
||||
|
||||
public draw(drawController: ScreenCanvasDrawController) {
|
||||
this.ime.sync(activeToolAcceptsText());
|
||||
this.ime.sync(activeToolWantsIme());
|
||||
const toolInstruction = getLastStateInstructions();
|
||||
const texts: string[] = [];
|
||||
if (toolInstruction) {
|
||||
@@ -122,8 +132,7 @@ export class InputController {
|
||||
const roundedY = round(drawController.getWorldMouseLocation().y, 2);
|
||||
texts.push(`${roundedX},${roundedY}`);
|
||||
}
|
||||
const lockHint = angleLockHint();
|
||||
if (lockHint) texts.push(lockHint);
|
||||
texts.push(...compact([angleLockHint(), snapOverrideHint()]));
|
||||
// 입력 중인 문자로 시작하는 명령 후보. 예: C => CIRCLE (C), COPY (CO)
|
||||
texts.push(...this.getCommandSuggestions());
|
||||
// 입력 글(조합 중인 한글도 함께)
|
||||
@@ -173,7 +182,7 @@ export class InputController {
|
||||
return;
|
||||
}
|
||||
this.sendMouseClick(evt);
|
||||
this.ime.sync(activeToolAcceptsText()); // 클릭으로 문자 단계에 들면 바로 한글 받개로
|
||||
this.ime.sync(activeToolWantsIme()); // 클릭으로 문자 단계에 들면 바로 한글 받개로
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +209,12 @@ export class InputController {
|
||||
const worldMouseLocationTemp = screenCanvasDrawController.targetToWorld(
|
||||
this.getCanvasPoint(evt)
|
||||
);
|
||||
const worldMouseLocation = closestSnapPoint ? closestSnapPoint.point : worldMouseLocationTemp;
|
||||
let worldMouseLocation = closestSnapPoint ? closestSnapPoint.point : worldMouseLocationTemp;
|
||||
if (getSnapOverride()) {
|
||||
const snapped = snapOverridePoint(worldMouseLocationTemp, getAngleGuideOriginPoint());
|
||||
if (!snapped) return; // 맞는 점 없음 — 다시 누르기를 기다림
|
||||
worldMouseLocation = snapped;
|
||||
}
|
||||
|
||||
this.sendPointEvent({
|
||||
type: ActorEvent.MOUSE_CLICK,
|
||||
@@ -408,12 +422,12 @@ export class InputController {
|
||||
} else if (evt.key === 'Enter') {
|
||||
// User wants to submit the input or submit the action
|
||||
this.handleEnterKey(true);
|
||||
this.ime.sync(activeToolAcceptsText());
|
||||
this.ime.sync(activeToolWantsIme());
|
||||
} else if (evt.key === ' ' && !activeToolWantsFreeText()) {
|
||||
// Space = Enter(오토캐드) · 글 단계는 아래 띄어쓰기 · 수정키 · 길게 눌러 반복은 무시
|
||||
if (isPlainSpace(evt)) {
|
||||
this.handleEnterKey(true);
|
||||
this.ime.sync(activeToolAcceptsText());
|
||||
this.ime.sync(activeToolWantsIme());
|
||||
}
|
||||
} else if (evt.key === 'ArrowDown') {
|
||||
// Move the screen down
|
||||
@@ -438,6 +452,7 @@ export class InputController {
|
||||
|
||||
public handleEscapeKey() {
|
||||
setAngleLock(null);
|
||||
setSnapOverride(null);
|
||||
if (getSelectedEntities().length > 0) {
|
||||
// Deselect entities
|
||||
setSelectedEntityIds([]);
|
||||
@@ -463,7 +478,6 @@ export class InputController {
|
||||
/** @param repeatIfIdle 키보드 Enter · Space — 빈 입력 + 선택 도구 대기면 마지막 명령 반복(우클릭은 확정만) */
|
||||
public handleEnterKey(repeatIfIdle = false) {
|
||||
// submit the text as input to the active tool and clear the input field
|
||||
const activeToolCanHandleTextInput = activeToolAcceptsText();
|
||||
|
||||
if (this.text === '') {
|
||||
console.log('ENTER: ', {
|
||||
@@ -496,8 +510,12 @@ export class InputController {
|
||||
// 거리 `100` · `x,y` · `@x,y` · `@d<a` · `d<a`
|
||||
this.sendPointEvent(this.pointEventFromText() as PointTextEvent);
|
||||
this.text = '';
|
||||
} else if (activeToolCanHandleTextInput) {
|
||||
// 지금 단계의 선택지(배열 L/R · 숫자 단계 글)
|
||||
} else if (isSnapName(this.text) && activeToolWantsPoint()) {
|
||||
// 한 번 스냅 END · MID · … — 다음 한 점만
|
||||
setSnapOverride(this.text);
|
||||
this.text = '';
|
||||
} else if (activeToolTakesText(this.text)) {
|
||||
// 지금 단계의 선택지(선 C · U · 배열 L/R · 숫자 단계 글)
|
||||
this.sendText();
|
||||
} else if (resolveCommandInput(this.text)) {
|
||||
// 명령 이름 또는 AutoCAD 별칭을 입력했다. 예: L, LINE, REC
|
||||
@@ -531,10 +549,11 @@ export class InputController {
|
||||
);
|
||||
}
|
||||
|
||||
/** 점 하나를 도구에 보냄 — 각도 고정은 이 한 점으로 끝 */
|
||||
/** 점 하나를 도구에 보냄 — 각도 고정 · 한 번 스냅은 이 한 점으로 끝 */
|
||||
private sendPointEvent(event: PointTextEvent | MouseClickEvent) {
|
||||
getActiveToolActor()?.send(event);
|
||||
setAngleLock(null);
|
||||
setSnapOverride(null);
|
||||
}
|
||||
|
||||
public handleUndo(evt: KeyboardEvent) {
|
||||
|
||||
Reference in New Issue
Block a user