"use client"; import { JSX } from "react"; interface RulerProps { orientation: "horizontal" | "vertical"; length: number; // mm 단위 offset?: number; // 스크롤 오프셋 (px) } // 고정 스케일 팩터 (화면 해상도와 무관) const MM_TO_PX = 4; export function Ruler({ orientation, length, offset = 0 }: RulerProps) { // mm를 px로 변환 const mmToPx = (mm: number) => mm * MM_TO_PX; const lengthPx = mmToPx(length); const isHorizontal = orientation === "horizontal"; // 눈금 생성 (10mm 단위 큰 눈금, 5mm 단위 중간 눈금, 1mm 단위 작은 눈금) const renderTicks = () => { const ticks: JSX.Element[] = []; const maxMm = length; for (let mm = 0; mm <= maxMm; mm++) { const px = mmToPx(mm); // 10mm 단위 큰 눈금 if (mm % 10 === 0) { ticks.push(
, ); // 숫자 표시 (10mm 단위) if (mm > 0) { ticks.push(