/** 특성 팔레트 본문 — 선택 객체의 값을 읽고 바로 고친다 (PROPERTIES) */ import type { FC } from 'react'; import type { Entity } from '../entities/Entity'; import { polylineLength, sampleEntityPoints } from '../helpers/geometry/sample-entity'; import { commonValue, LINE_TYPES, LINE_WIDTHS, paintNowCommitLater, restyle, selectionLineStyle, styleTargets, } from '../helpers/selection-style'; import { getLayers, getSelectedEntities } from '../state'; interface PropertiesEditorProps { compact?: boolean; } /** 고른 것을 사본으로 바꿈 — 되돌리기 한 칸(488) · 선 특성은 글 뺌 */ const applyToSelection = (mutate: (entity: Entity) => void) => restyle(getSelectedEntities(), mutate); const applyToLines = (mutate: (entity: Entity) => void) => restyle(styleTargets(getSelectedEntities()), mutate); /** 여러 객체가 값이 다르면 빈 칸(488 · 리본과 같은 규칙 · 고르면 모두에 적용) */ export const PropertiesEditor: FC = ({ compact = false }) => { const selected = getSelectedEntities(); const layers = getLayers(); const first = selected[0]; const view = selectionLineStyle(); if (!first) { return

선택된 객체가 없습니다.

; } const points = sampleEntityPoints(first); const box = first.getBoundingBox(); return (
{selected.length === 1 ? first.getType() : `여러 객체 (${selected.length})`}
{!compact && (
길이
{polylineLength(points).toFixed(3)}
크기
{(box.xmax - box.xmin).toFixed(3)} × {(box.ymax - box.ymin).toFixed(3)}
시작점
{points[0] ? `${points[0].x.toFixed(2)}, ${points[0].y.toFixed(2)}` : '-'}
그룹
{first.groupId ? '있음' : '없음'}
)}
); };