Files
dwg-dxf-viewer-hm/src/components/CoordReadout.tsx
T
minsung b114581c07 feat: React19+HMDesign shell with ported DWG/DXF viewer engine
Scaffolds the new app (Vite+React19+Tailwind v4) on HMDesign via git
submodule + npm workspace, ports src/viewer2d/* and optionsStore.ts
unchanged, and rebuilds the vanilla UI (toolbar/layers/properties/
options panels, coord readout, license dialog, load progress) as HM
Design System components. Panel drag/collapse ported from
panelUtils.ts as a React hook; Measure UI intentionally left
unwired per original app parity.

Typecheck and dev-server module serving verified; in-browser
rendering not yet verified in this session (no browser tool
available) — needs manual check.

Refs #1
2026-10-12 17:42:58 +09:00

25 lines
983 B
TypeScript

function formatCadCoord(v: number | null): string {
if (v === null || !Number.isFinite(v)) return '—';
const abs = Math.abs(v);
const digits = abs >= 1e6 ? 1 : abs >= 1e3 ? 2 : abs >= 1 ? 3 : 4;
return v.toFixed(digits);
}
export interface CoordReadoutProps {
point: { x: number; y: number; z: number } | null;
spaceKind: 'model' | 'paper' | 'other' | null;
}
export function CoordReadout({ point, spaceKind }: CoordReadoutProps) {
const unitLabel = spaceKind === 'paper' ? 'Paper' : 'UCS';
return (
<div
className="pointer-events-none fixed bottom-3 right-3 z-10 rounded-md border bg-card/90 px-3 py-1.5 font-mono text-xs text-muted-foreground shadow-sm backdrop-blur"
title={`마우스 위치 CAD 좌표 (${spaceKind === 'paper' ? 'Layout=Paper' : 'Model=UCS'} 도면단위)`}
>
X {formatCadCoord(point?.x ?? null)} · Y {formatCadCoord(point?.y ?? null)}{' '}
<span className="opacity-60">({unitLabel})</span>
</div>
);
}