- 고르기: 누름 = 더함 · 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
82 lines
2.7 KiB
TypeScript
82 lines
2.7 KiB
TypeScript
import { compact } from 'es-toolkit';
|
|
import { HOVERED_SNAP_POINT_TIME } from '../App.consts';
|
|
import type { ScreenCanvasDrawController } from '../drawControllers/screenCanvas.drawController';
|
|
import {
|
|
getAngleGuideEntities,
|
|
getDebugEntities,
|
|
getEntities,
|
|
getGhostHelperEntities,
|
|
getHighlightedEntityIds,
|
|
getHoveredSnapPoints,
|
|
getInputController,
|
|
getSelectedEntities,
|
|
getShouldDrawCursor,
|
|
getSnapPoint,
|
|
getSnapPointOnAngleGuide,
|
|
isDrawingReadOnly,
|
|
isOriginMarker,
|
|
isViewOnly,
|
|
} from '../state';
|
|
import {
|
|
drawCursor,
|
|
drawDebugEntities,
|
|
drawEntities,
|
|
drawGrips,
|
|
drawHelpers,
|
|
drawOriginMarker,
|
|
drawSnapPoint,
|
|
} from './draw-functions';
|
|
import { getClosestSnapPoint } from './get-closest-snap-point';
|
|
import { isPointEqual } from './is-point-equal';
|
|
import { drawScene } from './scene-cache';
|
|
import { drawGuide } from '../integration/guide-area';
|
|
|
|
/**
|
|
* Hover highlight is excluded from the static scene cache (it changes every
|
|
* mouse move) — re-draw the few highlighted entities on top of the blit.
|
|
*/
|
|
function drawHighlightedEntities(drawController: ScreenCanvasDrawController) {
|
|
const highlightedIds = getHighlightedEntityIds();
|
|
if (!highlightedIds.length) return;
|
|
const idSet = new Set(highlightedIds);
|
|
drawEntities(
|
|
drawController,
|
|
getEntities().filter((entity) => idSet.has(entity.id))
|
|
);
|
|
}
|
|
|
|
export function draw(drawController: ScreenCanvasDrawController) {
|
|
drawController.clear();
|
|
|
|
// Static scene (all entities): cached bitmap blit, rebuilt only when needed.
|
|
drawScene(drawController, performance.now());
|
|
drawHighlightedEntities(drawController);
|
|
|
|
if (isOriginMarker()) drawOriginMarker(drawController);
|
|
drawGuide(drawController); // 작도 영역 점선(169-1) — 겹판이라 저장 · 인쇄 안 됨
|
|
// 보기 전용 · 확정 도면은 그립 없음(H2 — 집지도 못함)
|
|
if (!isViewOnly() && !isDrawingReadOnly()) drawGrips(drawController, getSelectedEntities());
|
|
drawHelpers(drawController, getAngleGuideEntities());
|
|
drawEntities(drawController, getGhostHelperEntities());
|
|
drawDebugEntities(drawController, getDebugEntities());
|
|
|
|
const { snapPoint: closestSnapPoint } = getClosestSnapPoint(
|
|
compact([getSnapPoint(), getSnapPointOnAngleGuide()]),
|
|
drawController.getWorldMouseLocation()
|
|
);
|
|
const isMarked =
|
|
!!closestSnapPoint &&
|
|
getHoveredSnapPoints().some(
|
|
(hoveredSnapPoint) =>
|
|
hoveredSnapPoint.milliSecondsHovered > HOVERED_SNAP_POINT_TIME &&
|
|
isPointEqual(hoveredSnapPoint.snapPoint.point, closestSnapPoint.point)
|
|
);
|
|
drawSnapPoint(drawController, closestSnapPoint, isMarked);
|
|
|
|
// 미리보기는 십자 커서 · 명령 안내 · 좌표 풍선을 그리지 않는다(손 모양 커서).
|
|
if (getShouldDrawCursor() && !isViewOnly()) {
|
|
drawCursor(drawController);
|
|
getInputController().draw(drawController);
|
|
}
|
|
}
|