저장소 사고로 잃은 4개 커밋(38eb7cd4·b8a11756·281528bf·f60b488d)의 작업물을 하나로 다시 담았다. 내용은 동일하다. ■ 구조 - commands/: 명령 정의(id·AutoCAD 별칭·글리프·도구/즉시실행)를 단일 소스로 두고 리본·명령행·단축키가 모두 이 레지스트리를 읽는다. tools/tool.consts.ts 폐지. - ribbon/: 탭→패널→명령 데이터(ribbon.config.ts)와 범용 렌더러 분리. AutoCAD 배치(홈·삽입·주석·뷰·출력)와 패널 확장(▾)을 따른다. - tools/factories/sequence-tool.ts: 점·숫자·문자·객체·선택 단계를 선언하면 xstate 머신을 만들어 주는 공장. 명령당 170줄 보일러플레이트 제거. - helpers/geometry/: 3점 호·정다각형·타원·스플라인·구름형·평행이동·해치 스캔선· 점렬 샘플링 등 상태 없는 순수 함수. - Toolbar 483줄을 QuickAccessBar/Ribbon/InspectorPanel/StatusBar/CommandLine/ ViewControls/PropertiesEditor/QuickProperties로 분해. ■ 명령 (조사표 기준) - 1절 그리기 21건, 2절 수정 27건, 3절 도면층·특성·그룹·유틸리티 39건 전부 반영. - 5절 주석 34건 중 26건 반영(문자·치수 16종·지시선·표·구름형·주석 축척). - HatchEntity 추가(solid·pattern·cross·gradient) + JSON 왕복, Layer에 색·선가중치· 선종류·동결·투명도 필드 추가, 그리기 루프가 동결·숨김·투명도를 반영. ■ 화면 실측에서 고친 결함 - 명령행 포커스 상태에서 ENTER가 도구로 가지 않던 문제 - 명령행 문자 입력이 접두사가 같은 명령으로 실행되던 문제 - 명령이 끝나도 입력을 계속 먹던 문제(점 입력 명령만 반복, 나머지는 선택 도구 복귀) - 시퀀스 단계 인덱스 오사용 9건 + 단계 값 종류 검사 추가 - 해치 내부를 클릭해도 선택되지 않던 문제 미반영 8건(맞춤법 검사·꺾기 치수·치수 끊기/재연관/검사 치수·기하공차·지시선 수집· 축척 리스트 편집)은 조사표 `반영` 열과 PLAN.md에 사유를 적었다.
341 lines
8.2 KiB
TypeScript
341 lines
8.2 KiB
TypeScript
/** 홈 탭 — 수정 패널 명령 (조사표 2절 전 항목) */
|
|
import type { CadCommand } from './command.types';
|
|
import { Tool } from '../tools';
|
|
import { alignBottomToolStateMachine } from '../tools/align-bottom-tool';
|
|
import { alignCenterHorizontalToolStateMachine } from '../tools/align-center-horizontal-tool';
|
|
import { alignLeftToolStateMachine } from '../tools/align-left-tool';
|
|
import { alignCenterVerticalToolStateMachine } from '../tools/align-middle-vertical-tool';
|
|
import { alignRightToolStateMachine } from '../tools/align-right-tool';
|
|
import { alignTopToolStateMachine } from '../tools/align-top-tool';
|
|
import { arrayToolStateMachine } from '../tools/array-tool';
|
|
import { copyToolStateMachine } from '../tools/copy-tool';
|
|
import { eraserToolStateMachine } from '../tools/eraser-tool';
|
|
import {
|
|
blendToolStateMachine,
|
|
breakAtPointToolStateMachine,
|
|
breakToolStateMachine,
|
|
chamferToolStateMachine,
|
|
filletToolStateMachine,
|
|
} from '../tools/modify/corner-tools';
|
|
import {
|
|
drawOrderBackToolStateMachine,
|
|
drawOrderFrontToolStateMachine,
|
|
hatchEditToolStateMachine,
|
|
matchPropToolStateMachine,
|
|
overkillToolStateMachine,
|
|
reverseToolStateMachine,
|
|
setByLayerToolStateMachine,
|
|
} from '../tools/modify/property-tools';
|
|
import {
|
|
eraseToolStateMachine,
|
|
explodeToolStateMachine,
|
|
extendToolStateMachine,
|
|
joinToolStateMachine,
|
|
} from '../tools/modify/structure-tools';
|
|
import {
|
|
alignToolStateMachine,
|
|
lengthenToolStateMachine,
|
|
mirrorToolStateMachine,
|
|
offsetToolStateMachine,
|
|
stretchToolStateMachine,
|
|
} from '../tools/modify/transform-tools';
|
|
import { moveToolStateMachine } from '../tools/move-tool';
|
|
import { peditToolStateMachine } from '../tools/pedit-tool';
|
|
import { rotateToolStateMachine } from '../tools/rotate-tool';
|
|
import { scaleToolStateMachine } from '../tools/scale-tool';
|
|
|
|
export const MODIFY_COMMANDS: CadCommand[] = [
|
|
{
|
|
id: 'MOVE',
|
|
label: '이동',
|
|
aliases: ['M'],
|
|
glyph: '✥',
|
|
hint: '선택 객체를 기준점에서 새 위치로 이동한다',
|
|
tool: Tool.MOVE,
|
|
machine: moveToolStateMachine,
|
|
},
|
|
{
|
|
id: 'COPY',
|
|
label: '복사',
|
|
aliases: ['CO', 'CP'],
|
|
glyph: '⧉',
|
|
hint: '선택 객체를 하나 이상의 위치에 복제한다',
|
|
tool: Tool.COPY,
|
|
machine: copyToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ROTATE',
|
|
label: '회전',
|
|
aliases: ['RO'],
|
|
glyph: '↻',
|
|
hint: '기준점을 중심으로 객체를 회전한다',
|
|
tool: Tool.ROTATE,
|
|
machine: rotateToolStateMachine,
|
|
},
|
|
{
|
|
id: 'SCALE',
|
|
label: '축척',
|
|
aliases: ['SC'],
|
|
glyph: '⤢',
|
|
hint: '기준점과 비율로 크기를 변경한다',
|
|
tool: Tool.SCALE,
|
|
machine: scaleToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGN',
|
|
label: '정렬',
|
|
aliases: ['AL'],
|
|
glyph: '⇲',
|
|
hint: '원본점·대상점 두 쌍으로 객체를 이동·회전한다',
|
|
tool: Tool.ALIGN,
|
|
machine: alignToolStateMachine,
|
|
},
|
|
{
|
|
id: 'MIRROR',
|
|
label: '대칭',
|
|
aliases: ['MI'],
|
|
glyph: '⇋',
|
|
hint: '대칭축을 기준으로 객체를 반사 복사한다',
|
|
tool: Tool.MIRROR,
|
|
machine: mirrorToolStateMachine,
|
|
},
|
|
{
|
|
id: 'OFFSET',
|
|
label: '간격띄우기',
|
|
aliases: ['O'],
|
|
glyph: '⇶',
|
|
hint: '평행선·동심원을 지정 거리만큼 띄워 만든다',
|
|
tool: Tool.OFFSET,
|
|
machine: offsetToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ARRAY',
|
|
label: '배열',
|
|
aliases: ['AR'],
|
|
glyph: '⋮⋮',
|
|
hint: '직사각형 패턴으로 객체를 반복 배치한다',
|
|
tool: Tool.ARRAY,
|
|
machine: arrayToolStateMachine,
|
|
},
|
|
{
|
|
id: 'TRIM',
|
|
label: '자르기',
|
|
aliases: ['TR'],
|
|
glyph: '⌦',
|
|
hint: '교차점 사이의 필요 없는 부분을 잘라낸다',
|
|
tool: Tool.ERASER,
|
|
machine: eraserToolStateMachine,
|
|
},
|
|
{
|
|
id: 'EXTEND',
|
|
label: '연장',
|
|
aliases: ['EX'],
|
|
glyph: '⇥',
|
|
hint: '선의 끝을 지정한 경계까지 늘린다',
|
|
tool: Tool.EXTEND,
|
|
machine: extendToolStateMachine,
|
|
},
|
|
{
|
|
id: 'STRETCH',
|
|
label: '신축',
|
|
aliases: ['S'],
|
|
glyph: '↔',
|
|
hint: '기준점에 가까운 끝점을 끌어 늘린다',
|
|
tool: Tool.STRETCH,
|
|
machine: stretchToolStateMachine,
|
|
},
|
|
{
|
|
id: 'FILLET',
|
|
label: '모깎기',
|
|
aliases: ['F'],
|
|
glyph: '◟',
|
|
hint: '두 선을 지정 반지름의 호로 연결한다',
|
|
tool: Tool.FILLET,
|
|
machine: filletToolStateMachine,
|
|
},
|
|
{
|
|
id: 'CHAMFER',
|
|
label: '모따기',
|
|
aliases: ['CHA'],
|
|
glyph: '◺',
|
|
hint: '두 선을 직선 모따기로 연결한다',
|
|
tool: Tool.CHAMFER,
|
|
machine: chamferToolStateMachine,
|
|
},
|
|
{
|
|
id: 'BLEND',
|
|
label: '곡선 혼합',
|
|
glyph: '∿',
|
|
hint: '두 곡선의 끝을 부드러운 곡선으로 잇는다',
|
|
tool: Tool.BLEND,
|
|
machine: blendToolStateMachine,
|
|
},
|
|
{
|
|
id: 'BREAK',
|
|
label: '끊기',
|
|
aliases: ['BR'],
|
|
glyph: '⊣⊢',
|
|
hint: '두 점 사이를 제거해 객체를 끊는다',
|
|
tool: Tool.BREAK,
|
|
machine: breakToolStateMachine,
|
|
},
|
|
{
|
|
id: 'BREAKATPOINT',
|
|
label: '점에서 끊기',
|
|
glyph: '⊥',
|
|
hint: '지정한 점에서 객체를 둘로 나눈다',
|
|
tool: Tool.BREAK_AT_POINT,
|
|
machine: breakAtPointToolStateMachine,
|
|
},
|
|
{
|
|
id: 'JOIN',
|
|
label: '결합',
|
|
aliases: ['J'],
|
|
glyph: '⋈',
|
|
hint: '끝이 맞는 객체를 하나의 폴리선으로 결합한다',
|
|
tool: Tool.JOIN,
|
|
machine: joinToolStateMachine,
|
|
},
|
|
{
|
|
id: 'EXPLODE',
|
|
label: '분해',
|
|
aliases: ['X'],
|
|
glyph: '✳',
|
|
hint: '폴리선·사각형·해치를 구성요소로 분해한다',
|
|
tool: Tool.EXPLODE,
|
|
machine: explodeToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ERASE',
|
|
label: '지우기',
|
|
aliases: ['E'],
|
|
glyph: '⌫',
|
|
hint: '선택한 객체를 삭제한다',
|
|
tool: Tool.ERASE,
|
|
machine: eraseToolStateMachine,
|
|
},
|
|
{
|
|
id: 'LENGTHEN',
|
|
label: '길이조정',
|
|
aliases: ['LEN'],
|
|
glyph: '↦',
|
|
hint: '선의 길이를 증분만큼 늘리거나 줄인다',
|
|
tool: Tool.LENGTHEN,
|
|
machine: lengthenToolStateMachine,
|
|
},
|
|
{
|
|
id: 'PEDIT',
|
|
label: '폴리선 편집',
|
|
aliases: ['PE'],
|
|
glyph: '⌁',
|
|
hint: '연결된 선을 폴리선으로 묶거나 편집한다',
|
|
tool: Tool.PEDIT,
|
|
machine: peditToolStateMachine,
|
|
},
|
|
{
|
|
id: 'HATCHEDIT',
|
|
label: '해치 편집',
|
|
aliases: ['HE'],
|
|
glyph: '▨',
|
|
hint: '기존 해치의 패턴을 바꾼다',
|
|
tool: Tool.HATCHEDIT,
|
|
machine: hatchEditToolStateMachine,
|
|
},
|
|
{
|
|
id: 'DRAWORDER',
|
|
label: '맨 앞으로',
|
|
aliases: ['DR'],
|
|
glyph: '⤒',
|
|
hint: '선택 객체를 가장 위에 그린다',
|
|
tool: Tool.DRAWORDER_FRONT,
|
|
machine: drawOrderFrontToolStateMachine,
|
|
},
|
|
{
|
|
id: 'DRAWORDERBACK',
|
|
label: '맨 뒤로',
|
|
glyph: '⤓',
|
|
hint: '선택 객체를 가장 아래에 그린다',
|
|
tool: Tool.DRAWORDER_BACK,
|
|
machine: drawOrderBackToolStateMachine,
|
|
},
|
|
{
|
|
id: 'MATCHPROP',
|
|
label: '특성 일치',
|
|
aliases: ['MA'],
|
|
glyph: '🖌',
|
|
hint: '원본 객체의 색·굵기·선종류를 대상에 복사한다',
|
|
tool: Tool.MATCHPROP,
|
|
machine: matchPropToolStateMachine,
|
|
},
|
|
{
|
|
id: 'OVERKILL',
|
|
label: '중복 객체 삭제',
|
|
glyph: '⧉',
|
|
hint: '같은 자리에 겹친 중복 객체를 지운다',
|
|
tool: Tool.OVERKILL,
|
|
machine: overkillToolStateMachine,
|
|
},
|
|
{
|
|
id: 'REVERSE',
|
|
label: '방향 반전',
|
|
glyph: '⇄',
|
|
hint: '선·폴리선의 시작점과 끝점을 뒤집는다',
|
|
tool: Tool.REVERSE,
|
|
machine: reverseToolStateMachine,
|
|
},
|
|
{
|
|
id: 'SETBYLAYER',
|
|
label: 'ByLayer로',
|
|
glyph: '▤',
|
|
hint: '선택 객체의 특성을 도면층 값으로 되돌린다',
|
|
tool: Tool.SETBYLAYER,
|
|
machine: setByLayerToolStateMachine,
|
|
},
|
|
];
|
|
|
|
/** 원본 openwebcad의 정렬 도구 — AutoCAD 리본에는 없지만 기존 기능이라 유지한다 */
|
|
export const ALIGN_COMMANDS: CadCommand[] = [
|
|
{
|
|
id: 'ALIGNLEFT',
|
|
label: '왼쪽',
|
|
glyph: '⇤',
|
|
tool: Tool.ALIGN_LEFT,
|
|
machine: alignLeftToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGNCENTERH',
|
|
label: '가로 중앙',
|
|
glyph: '↔',
|
|
tool: Tool.ALIGN_CENTER_HORIZONTAL,
|
|
machine: alignCenterHorizontalToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGNRIGHT',
|
|
label: '오른쪽',
|
|
glyph: '⇥',
|
|
tool: Tool.ALIGN_RIGHT,
|
|
machine: alignRightToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGNTOP',
|
|
label: '위',
|
|
glyph: '⤒',
|
|
tool: Tool.ALIGN_TOP,
|
|
machine: alignTopToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGNCENTERV',
|
|
label: '세로 중앙',
|
|
glyph: '↕',
|
|
tool: Tool.ALIGN_CENTER_VERTICAL,
|
|
machine: alignCenterVerticalToolStateMachine,
|
|
},
|
|
{
|
|
id: 'ALIGNBOTTOM',
|
|
label: '아래',
|
|
glyph: '⤓',
|
|
tool: Tool.ALIGN_BOTTOM,
|
|
machine: alignBottomToolStateMachine,
|
|
},
|
|
];
|