- 문자를 기다리는 단계(TEXT · MTEXT · 표 칸 · 지시선)에서 숨은 input 에 초점 · compositionupdate/end 로 글자 받음 - 조합 중 키(isComposing · 229 · Process)는 단축키 처리에서 건너뜀 · 명령줄도 같음 - 명령 단계는 초점을 풀어 한글 자판이어도 영문 명령 그대로 - 입력 해석 패턴을 input-patterns.ts 로 나눔(700줄 상한) - 검증 창구 entities 에 label · 시나리오 ui_checks/44-8_CAD_한글입력.js Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UoSr2sqvYtBf1dtQdus88s
64 lines
2.3 KiB
TypeScript
64 lines
2.3 KiB
TypeScript
/**
|
|
* 화면 검증용 상태 조회 창구 — 브라우저 콘솔·자동화 스크립트가
|
|
* window.__aisloCad로 현재 객체·도면층·선택을 읽는다. 앱 동작에는 관여하지 않는다.
|
|
*/
|
|
import {
|
|
getDesignMeta,
|
|
getEntities,
|
|
getHighlightedEntityIds,
|
|
getLayers,
|
|
getSelectedEntityIds,
|
|
getScreenCanvasDrawController,
|
|
getSnapPoint,
|
|
isDrawingDirty,
|
|
isDrawingReadOnly,
|
|
isOriginMarker,
|
|
isViewOnly,
|
|
} from '../state';
|
|
import { Point } from '@flatten-js/core';
|
|
import { isEntityHidden } from './visibility';
|
|
|
|
export function registerCadDebugHook(): void {
|
|
(window as unknown as Record<string, unknown>).__aisloCad = {
|
|
entities: () =>
|
|
getEntities().map((entity) => {
|
|
const box = entity.getBoundingBox();
|
|
return {
|
|
id: entity.id,
|
|
type: entity.getType(),
|
|
layerId: entity.layerId,
|
|
groupId: entity.groupId ?? null,
|
|
opacity: entity.opacity ?? null,
|
|
hidden: isEntityHidden(entity),
|
|
color: entity.lineColor,
|
|
// 글자 객체의 내용 — 한글 입력(IME) 검증이 읽는다
|
|
label: (entity as { getLabel?: () => string }).getLabel?.() ?? null,
|
|
box: [
|
|
Math.round(box.xmin),
|
|
Math.round(box.ymin),
|
|
Math.round(box.xmax),
|
|
Math.round(box.ymax),
|
|
],
|
|
};
|
|
}),
|
|
layers: () => getLayers(),
|
|
selection: () => getSelectedEntityIds(),
|
|
// 마우스 위치의 객체 스냅점 — 잠금 도면층(도각)이 스냅에 끼는지 검증할 때 읽는다.
|
|
snap: () => getSnapPoint(),
|
|
// 마우스가 스친 객체 — 잠금층(도각·등고선)이 밝아지는지 수치로 본다.
|
|
highlighted: () => getHighlightedEntityIds(),
|
|
// 확정 도면의 편집 잠금과 미저장 표시 — 화면 검증이 상태를 직접 읽는다.
|
|
readOnly: () => isDrawingReadOnly(),
|
|
dirty: () => isDrawingDirty(),
|
|
meta: () => getDesignMeta(),
|
|
// 기준점 십자 · 미리보기(보기 전용) 켜짐 — 그림이 안 도는 탭에서도 수치로 본다.
|
|
originMarker: () => isOriginMarker(),
|
|
viewOnly: () => isViewOnly(),
|
|
// 세계 좌표 → 화면 좌표. 그림·글자가 "제 자리에 그려졌나"를 픽셀로 판정할 때 쓴다.
|
|
screen: (x: number, y: number) => {
|
|
const point = getScreenCanvasDrawController().worldToTarget(new Point(x, y));
|
|
return { x: point.x, y: point.y };
|
|
},
|
|
};
|
|
}
|