import { ColorPicker, Empty, Input, InputNumber, Select, Slider, Switch } from 'antd'; import type { AnnotationElement } from '@/types/annotation'; import { FONT_FAMILIES } from '@/utils/annotation'; interface ElementPropsPanelProps { element: AnnotationElement | null; onUpdate: (id: number, patch: Partial) => void; } const FONT_OPTIONS = FONT_FAMILIES.map((f) => ({ value: f, label: f })); const ElementPropsPanel = ({ element, onUpdate }: ElementPropsPanelProps) => { if (!element) { return (

点击画布上的文字或标尺进行编辑

); } const update = (patch: Partial) => onUpdate(element.id, patch); return (
{element.type === 'text' ? ( <>
内容 update({ content: e.target.value })} />
字体 update({ label: e.target.value })} />
标签颜色 update({ labelColor: c.toHexString() })} />
标签字号 update({ labelFontSize: v ?? 14 })} style={{ flex: 1 }} />
)}
透明度 update({ opacity: v })} style={{ flex: 1 }} />
旋转(°) update({ rotation: (v ?? 0) % 360 })} style={{ flex: 1 }} />
); }; export default ElementPropsPanel;