- 부품 상자 CSS · 단추 기본 꼴을 CAD iframe 에 실음(integration/ui-kit.ts) · 자리 · 폭은 cad-* 그대로 - 상태막대 = ui-toggle--chip 22 · 특성/레이어 = ui-tabs 36 · ↶↷ · 리본 접기 · 탐색 막대 = ui-icon-btn 20 · 32 - 빠른 특성 · 블록 라이브러리 · 자리표 = ui-float-panel · 리본 넘침 · 스냅 · 명령 자동완성 = ui-ctx-menu - window.confirm · window.prompt → askConfirm · askText · 빈 안내 = ui-empty 작은 꼴 - 높이 단: 리본 칸 19→18 · 명령 칸 26→28 · 레이어 줄 40→42 · 문서 탭 25→24 · 도각 편집 단추 24 - 마우스 바탕 = --color-hover · 켜짐 = --color-accent-soft · 도면 그림 색(--draw-*) 안 건드림 - 안 쓰는 DropdownButton 지움(쓰는 곳 0 · grep) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
76 lines
2.6 KiB
TypeScript
76 lines
2.6 KiB
TypeScript
/** 삽입 탭 명령 (조사표 4절 중 구현분) */
|
|
import { toast } from 'react-toastify';
|
|
import { saveBlockFromEntities } from '../blocks/block-library';
|
|
import { setBlockLibraryVisible } from '../components/ui-state';
|
|
import { importImageFromFile } from '../helpers/import-export-handlers/import-image-from-file';
|
|
import { pickFile } from '../helpers/pick-file';
|
|
import { importDrawingFile } from '../integration/dxf-clip-paste';
|
|
import { askText } from '../integration/ui-kit';
|
|
import { getActiveToolActor, getSelectedEntities } from '../state';
|
|
import { Tool } from '../tools';
|
|
import { imageImportToolStateMachine } from '../tools/image-import-tool';
|
|
import { ActorEvent, type FileSelectedEvent } from '../tools/tool.types';
|
|
import type { CadCommand } from './command.types';
|
|
|
|
export const INSERT_COMMANDS: CadCommand[] = [
|
|
{
|
|
id: 'IMAGEATTACH',
|
|
label: '이미지 부착',
|
|
aliases: ['IAT'],
|
|
glyph: '🖼',
|
|
hint: '래스터 이미지를 도면에 배치한다',
|
|
tool: Tool.IMAGE_IMPORT,
|
|
machine: imageImportToolStateMachine,
|
|
// 도구가 FILE_SELECTED를 기다리므로 파일 선택창을 띄워 이미지를 넣어 준다
|
|
run: () => {
|
|
pickFile('image/*', async (file) => {
|
|
const image = await importImageFromFile(file);
|
|
const event: FileSelectedEvent = { type: ActorEvent.FILE_SELECTED, image };
|
|
getActiveToolActor()?.send(event);
|
|
});
|
|
return '이미지 파일 선택';
|
|
},
|
|
},
|
|
{
|
|
id: 'BLOCK',
|
|
label: '블록 작성',
|
|
aliases: ['B'],
|
|
glyph: '🧩',
|
|
hint: '선택한 객체를 이름 붙여 블록 라이브러리에 저장한다',
|
|
needsSelection: true,
|
|
run: () => {
|
|
const entities = getSelectedEntities();
|
|
// 글 묻기 = 확인창 부품(window.prompt 대신 · 553-6)
|
|
void askText({ message: '블록 이름', okLabel: '저장' }).then(async (text) => {
|
|
const name = text?.trim();
|
|
if (!name) return;
|
|
await saveBlockFromEntities(name, entities);
|
|
toast.success(`블록 '${name}' 저장 (객체 ${entities.length}개)`);
|
|
setBlockLibraryVisible(true);
|
|
});
|
|
return '블록 이름 입력';
|
|
},
|
|
},
|
|
{
|
|
id: 'INSERT',
|
|
label: '블록 삽입',
|
|
aliases: ['I'],
|
|
glyph: '📥',
|
|
hint: '라이브러리에 저장한 블록을 도면에 놓는다',
|
|
run: () => {
|
|
setBlockLibraryVisible(true);
|
|
return '블록 라이브러리';
|
|
},
|
|
},
|
|
{
|
|
id: 'IMPORT',
|
|
label: 'DWG 불러오기',
|
|
glyph: '📂',
|
|
hint: 'DWG · DXF 파일을 지금 도면에 원좌표 그대로 더한다(골라진 채 · 되돌리기 한 번에 빠짐)',
|
|
run: () => {
|
|
pickFile('.dwg,.dxf', importDrawingFile);
|
|
return 'DWG · DXF 파일 선택';
|
|
},
|
|
},
|
|
];
|