import { useRef } from "react"; import { RegularPolygon } from "react-konva"; import Konva from "konva"; import type { ShapeProps } from "./types"; const TriangleShape = ({ obj, isSelected, onSelect, onUpdate, draggable }: ShapeProps) => { const shapeRef = useRef(null); // Transformer is managed in EditorCanvas for multi-select support const isMask = obj.isMask || false; const showGuide = obj.showMaskGuide !== false; const radius = Math.min((obj.width || 100) / 2, (obj.height || 100) / 2); return ( { if (shapeRef.current) { onSelect(obj.id, shapeRef.current, e); } }} onDragMove={(e) => { const node = e.target; onUpdate(obj.id, { x: node.x() - (obj.width || 100) / 2, y: node.y() - (obj.height || 100) / 2, }); }} onDragEnd={(e) => { const node = e.target; onUpdate(obj.id, { x: node.x() - (obj.width || 100) / 2, y: node.y() - (obj.height || 100) / 2, }); }} /> ); }; export default TriangleShape;