Merge remote-tracking branch 'origin/main_desktop_1' into main_laptop_1
This commit is contained in:
@@ -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();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
},
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user