diff --git a/B07_DesignDetail/openwebcad/src/App.consts.ts b/B07_DesignDetail/openwebcad/src/App.consts.ts index 7f4c9292..8e517983 100644 --- a/B07_DesignDetail/openwebcad/src/App.consts.ts +++ b/B07_DesignDetail/openwebcad/src/App.consts.ts @@ -65,6 +65,9 @@ export const HIGHLIGHT_ENTITY_DISTANCE = 15; * The size of the snap point indicator shapes that are shown on active snap points */ export const SNAP_POINT_SIZE = 15; +/** 그립 사각형의 화면 크기(px)와 색 — 선택 객체의 편집점 */ +export const GRIP_SIZE = 8; +export const GRIP_COLOR = '#3aa0ff'; /** * How long you need to hover over a snap point to make it a marked snap point that will show angle guides diff --git a/B07_DesignDetail/openwebcad/src/commands/commands.file.ts b/B07_DesignDetail/openwebcad/src/commands/commands.file.ts index 71c1c3a8..a1bc7986 100644 --- a/B07_DesignDetail/openwebcad/src/commands/commands.file.ts +++ b/B07_DesignDetail/openwebcad/src/commands/commands.file.ts @@ -1,11 +1,12 @@ /** 빠른 실행 도구막대 · 출력 탭 명령 (파일 수명주기) */ import { toast } from 'react-toastify'; -import type { CadCommand } from './command.types'; +import { clearRecovery, restoreRecovery } from '../helpers/autosave'; import { exportEntitiesToJsonFile } from '../helpers/import-export-handlers/export-entities-to-json'; import { exportEntitiesToLocalStorage } from '../helpers/import-export-handlers/export-entities-to-local-storage'; import { exportEntitiesToPngFile } from '../helpers/import-export-handlers/export-entities-to-png'; import { exportEntitiesToSvgFile } from '../helpers/import-export-handlers/export-entities-to-svg'; import { redo, undo } from '../state'; +import type { CadCommand } from './command.types'; export const FILE_COMMANDS: CadCommand[] = [ { @@ -15,10 +16,23 @@ export const FILE_COMMANDS: CadCommand[] = [ glyph: '💾', hint: '현재 도면을 브라우저에 저장한다', run: () => { - void exportEntitiesToLocalStorage().then(() => toast.success('도면을 저장했습니다.')); + void exportEntitiesToLocalStorage().then(() => { + clearRecovery(); + toast.success('도면을 저장했습니다.'); + }); return '도면 저장'; }, }, + { + id: 'RECOVER', + label: '백업 복구', + glyph: '⟲', + hint: '자동 백업된 마지막 편집을 되살린다', + run: () => { + void restoreRecovery(); + return '백업 복구'; + }, + }, { id: 'EXPORT', label: 'JSON 내보내기', diff --git a/B07_DesignDetail/openwebcad/src/components/RibbonWidgets.tsx b/B07_DesignDetail/openwebcad/src/components/RibbonWidgets.tsx index 1b05d47a..fe8ece4a 100644 --- a/B07_DesignDetail/openwebcad/src/components/RibbonWidgets.tsx +++ b/B07_DesignDetail/openwebcad/src/components/RibbonWidgets.tsx @@ -1,5 +1,6 @@ /** 리본 안에 들어가는 위젯 패널 — 특성(색·굵기·선종류), 도면층, 문자 스타일 */ import type { FC } from 'react'; +import { runCommandInput } from '../commands/run-command'; import type { Entity } from '../entities/Entity'; import { EntityName } from '../entities/Entity'; import type { TextEntity } from '../entities/TextEntity'; @@ -19,7 +20,6 @@ import { setActiveTextStyle, setEntities, } from '../state'; -import { runCommandInput } from '../commands/run-command'; export const LINE_TYPES: { value: string; label: string; dash: number[] | undefined }[] = [ { value: 'solid', label: '실선', dash: undefined }, @@ -178,6 +178,22 @@ export const TextStyleWidget: FC = () => { }} /> + +