({
rectangles,
isPointerTool,
onSelect,
onDragEnd,
onTransformEnd,
registerRef,
selectedShapeId,
}: RectangleShapesProps)
| 38 | } |
| 39 | |
| 40 | export const RectangleShapes = ({ |
| 41 | rectangles, |
| 42 | isPointerTool, |
| 43 | onSelect, |
| 44 | onDragEnd, |
| 45 | onTransformEnd, |
| 46 | registerRef, |
| 47 | selectedShapeId, |
| 48 | }: RectangleShapesProps) => ( |
| 49 | <> |
| 50 | {rectangles.map((rect) => ( |
| 51 | <Rect |
| 52 | key={rect.id} |
| 53 | ref={(node) => registerRef(rect.id, node)} |
| 54 | {...rect} |
| 55 | stroke={selectedShapeId === rect.id ? "#1d4ed8" : rect.stroke} |
| 56 | draggable={isPointerTool} |
| 57 | onMouseDown={(e) => { |
| 58 | if (!isPointerTool) return; |
| 59 | e.cancelBubble = true; |
| 60 | onSelect(rect.id, "rectangle"); |
| 61 | }} |
| 62 | onTouchStart={(e) => { |
| 63 | if (!isPointerTool) return; |
| 64 | e.cancelBubble = true; |
| 65 | onSelect(rect.id, "rectangle"); |
| 66 | }} |
| 67 | onTransformEnd={(e) => onTransformEnd(rect.id, e)} |
| 68 | onDragEnd={(e) => onDragEnd(rect.id, e)} |
| 69 | /> |
| 70 | ))} |
| 71 | </> |
| 72 | ); |
| 73 | |
| 74 | interface EllipseShapesProps { |
| 75 | ellipses: (EllipseShape & EllipseProperties)[]; |
nothing calls this directly
no outgoing calls
no test coverage detected