From 4cb02651a2f8b6e2a4ed3db8f3e7364e46816ece Mon Sep 17 00:00:00 2001 From: umsangdon Date: Thu, 8 Oct 2026 15:22:21 +0900 Subject: [PATCH] =?UTF-8?q?fix(B07):=20CAD=20=EC=9E=91=EC=9D=80=20?= =?UTF-8?q?=ED=9D=A0=20=EC=85=8B=20=E2=80=94=20=EC=9B=90=20=EB=8F=84?= =?UTF-8?q?=EA=B5=AC=20Esc=20=EC=B7=A8=EC=86=8C=20=C2=B7=20TEXT=20?= =?UTF-8?q?=EB=8C=80=EC=86=8C=EB=AC=B8=EC=9E=90=20=EB=B3=B4=EC=A1=B4=20?= =?UTF-8?q?=C2=B7=20=EB=93=9C=EB=A1=AD=EB=8B=A4=EC=9A=B4=20Space=20?= =?UTF-8?q?=ED=82=A4=20=EA=B0=92(99-5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../openwebcad/src/helpers/keyboard-handler.ts | 2 +- .../openwebcad/src/inputController/ime-sink.test.ts | 2 +- .../src/inputController/input-controller.ts | 3 ++- B07_DesignDetail/openwebcad/src/tools/circle-tool.ts | 11 ++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/B07_DesignDetail/openwebcad/src/helpers/keyboard-handler.ts b/B07_DesignDetail/openwebcad/src/helpers/keyboard-handler.ts index 1f69e423c..f9c9fb947 100644 --- a/B07_DesignDetail/openwebcad/src/helpers/keyboard-handler.ts +++ b/B07_DesignDetail/openwebcad/src/helpers/keyboard-handler.ts @@ -2,7 +2,7 @@ import type { KeyboardEvent } from 'react'; export function keyboardHandler(clickHandler: () => void) { return (evt: KeyboardEvent) => { - if (evt.key === 'Enter' || evt.key === 'Space') { + if (evt.key === 'Enter' || evt.key === ' ') { clickHandler(); } }; diff --git a/B07_DesignDetail/openwebcad/src/inputController/ime-sink.test.ts b/B07_DesignDetail/openwebcad/src/inputController/ime-sink.test.ts index 22ed47630..47feaa2a7 100644 --- a/B07_DesignDetail/openwebcad/src/inputController/ime-sink.test.ts +++ b/B07_DesignDetail/openwebcad/src/inputController/ime-sink.test.ts @@ -108,7 +108,7 @@ describe('Space = Enter(오토캐드)', () => { press(controller, 'a'); press(controller, ' '); press(controller, 'b'); - expect(textOf(controller)).toBe('A B'); + expect(textOf(controller)).toBe('a b'); expect(activeTool()).toBe(Tool.TEXT); }); diff --git a/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts b/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts index e74c7502c..dd3c6c21c 100644 --- a/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts +++ b/B07_DesignDetail/openwebcad/src/inputController/input-controller.ts @@ -467,7 +467,8 @@ export class InputController { // +·-는 확대·축소 단축키로 쓰지 않는다 — 음수 좌표(-100,-50)의 첫 글자를 // 먹어 버렸다. 줌은 휠·뷰 막대·ZOOMIN/ZOOMOUT 명령으로 한다. // User entered a single character => add to input field text - this.text += evt.key.toUpperCase(); + // 글 단계(TEXT·MTEXT)는 친 그대로 — 명령 입력일 때만 대문자로 바꾼다. + this.text += activeToolWantsFreeText() ? evt.key : evt.key.toUpperCase(); } } diff --git a/B07_DesignDetail/openwebcad/src/tools/circle-tool.ts b/B07_DesignDetail/openwebcad/src/tools/circle-tool.ts index 716d881f2..cbd81db8f 100644 --- a/B07_DesignDetail/openwebcad/src/tools/circle-tool.ts +++ b/B07_DesignDetail/openwebcad/src/tools/circle-tool.ts @@ -6,6 +6,7 @@ import { getActiveLineColor, getActiveLineDash, getActiveLineWidth, + setActiveToolActor, setAngleGuideOriginPoint, setGhostHelperEntities, setSelectedEntityIds, @@ -13,9 +14,10 @@ import { } from '../state'; import type { DrawEvent, PointInputEvent, StateEvent, ToolContext } from './tool.types'; import { Tool } from '../tools'; -import { assign, createMachine } from 'xstate'; +import { Actor, assign, createMachine } from 'xstate'; import { pointDistance } from '../helpers/distance-between-points'; import { LineState } from './line-tool.ts'; +import { selectToolStateMachine } from './select-tool.ts'; import { getPointFromEvent } from '../helpers/get-point-from-event.ts'; export interface CircleContext extends ToolContext { @@ -33,6 +35,7 @@ export enum CircleAction { RECORD_START_POINT = 'RECORD_START_POINT', DRAW_TEMP_CIRCLE = 'DRAW_TEMP_CIRCLE', DRAW_FINAL_CIRCLE = 'DRAW_FINAL_CIRCLE', + SWITCH_TO_SELECT_TOOL = 'SWITCH_TO_SELECT_TOOL', } export const circleToolStateMachine = createMachine( @@ -68,6 +71,9 @@ export const circleToolStateMachine = createMachine( actions: CircleAction.RECORD_START_POINT, target: CircleState.WAITING_FOR_POINT_ON_CIRCLE, }, + ESC: { + actions: CircleAction.SWITCH_TO_SELECT_TOOL, + }, }, }, [CircleState.WAITING_FOR_POINT_ON_CIRCLE]: { @@ -159,6 +165,9 @@ export const circleToolStateMachine = createMachine( centerPoint: null, }; }), + [CircleAction.SWITCH_TO_SELECT_TOOL]: () => { + setActiveToolActor(new Actor(selectToolStateMachine)); + }, }, } );