Files
Aislo/B07_DesignDetail/openwebcad/src/commands/commands.view.ts
T
eomsangdonandClaude Opus 5.5 db8462c6d4 feat(B07 CAD): 337-2 마-1 오토캐드 마우스 — 누름 더함 · Shift 뺌 · 상자 더함/뺌 · 명령 중 끌기 상자 · 스침 · 그립 누르고-옮기고-누르기 · 그립 숫자 · 보기 전용 문 · 직교 강제 · Shift 임시 직교 · 휠 기본 밂 · 휠 두 번 범위
- 고르기: 누름 = 더함 · Shift = 뺌 · Ctrl = 넣고 빼기 · 상자 = 앞 고름 ∪ 상자 · Shift 상자 = 뺌(H4 · H5) · 명령 안 고르기 단계도 누를 때 첫 점 · 스침 강조(ic/selecting.ts)
- 그립: 쉴 때만 집음(N7) · 누르고 떼면 대기 → 다음 누름에 놓음 · 끌어 놓기(H3) · 거리 숫자(N8) · 확정 · 읽기 전용 도면은 그립 · Delete 막음(H2)
- 직교: F8 = 기준점에서 가로 · 세로 강제 · Shift 누른 동안 뒤집음 · 객체 스냅 점 · 좌표 · 각도 잠금은 안 덮음 · 클릭 사건 snapped 채움(ic/ortho.ts · H8) · 가이드는 F3 와 뗌 · 가이드 잡는 거리 = 화면 픽셀(H9)
- 휠: 기본 밂(앞으로 굴리면 확대 · 오토캐드 · 모든 화면 · ☰ 설정 뒤집기 그대로) · 가운데 단추 두 번 = 범위 줌 · ZOOM · ⛶ 앞 화면 기억(ic/zoom-prompt.ts)
- 시험: mouse-acad 새로 · 휠 방향 시험 손질(input-wheel · input-prefs-cad · input_prefs · app_settings · 164 · 220_1 · 221_1 · 244_8 기대값 뒤집음 · 266 pull 박음)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Se7ytqbohmBQnfYpwYFnYf
2026-10-15 23:41:46 +09:00

89 lines
2.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** 뷰 탭 — 탐색·재생성 명령 (조사표 7절 중 구현분) */
import { Point } from '@flatten-js/core';
import { toast } from 'react-toastify';
import type { CadCommand } from './command.types';
import { bumpSceneVersion } from '../helpers/scene-version';
import { getScreenCanvasDrawController, setEntities, getEntities } from '../state';
import { Tool } from '../tools';
import { selectToolStateMachine } from '../tools/select-tool';
import { zoomExtents } from '../inputController/zoom-prompt';
const zoomBy = (factor: number): string => {
const controller = getScreenCanvasDrawController();
const oldScale = controller.getScreenScale();
const newScale = Math.max(0.01, oldScale * factor);
// 배율만 바꾸면 화면이 월드 원점 쪽으로 늘어나 도면이 화면 밖으로 밀려난다.
// 휠 줌이 커서 밑 좌표를 붙잡아 두듯, 버튼 줌은 **화면 중심**의 월드 좌표를
// 붙잡아 둔다 (screen = (world - offset) * scale).
const canvasSize = controller.getCanvasSize();
const offset = controller.getScreenOffset();
const worldCenterX = offset.x + canvasSize.x / 2 / oldScale;
const worldCenterY = offset.y + canvasSize.y / 2 / oldScale;
controller.setScreenScale(newScale);
controller.setScreenOffset(
new Point(
worldCenterX - canvasSize.x / 2 / newScale,
worldCenterY - canvasSize.y / 2 / newScale
)
);
return `줌 ${Math.round(newScale * 100)}%`;
};
export const VIEW_COMMANDS: CadCommand[] = [
{
id: 'SELECT',
label: '선택',
aliases: ['SE'],
glyph: '↖',
hint: '객체를 클릭하거나 선택 사각형으로 고른다',
tool: Tool.SELECT,
machine: selectToolStateMachine,
},
{
id: 'ZOOM',
label: '범위 줌',
aliases: ['Z'],
glyph: '⛶',
hint: '도면 전체가 보이도록 화면을 맞춘다',
run: () => {
zoomExtents(); // 앞 화면 기억(이전(P))
return '도면 전체 보기';
},
},
{
id: 'ZOOMIN',
label: '확대',
glyph: '+',
run: () => zoomBy(1.25),
},
{
id: 'ZOOMOUT',
label: '축소',
glyph: '-',
run: () => zoomBy(0.8),
},
{
id: 'REGEN',
label: '재생성',
aliases: ['RE'],
glyph: '⟳',
hint: '화면 캐시를 버리고 객체를 다시 그린다',
run: () => {
bumpSceneVersion();
setEntities([...getEntities()], false);
return '화면 재생성';
},
},
{
id: 'PAN',
label: '초점이동',
aliases: ['P'],
glyph: '✋',
hint: '휠 버튼을 누른 채 끌면 화면이 움직인다',
run: () => {
toast.info('휠 버튼을 누른 채 끌면 화면이 이동합니다.');
return '초점이동 안내';
},
},
];