MCPcopy Create free account
hub / github.com/Shitanshukumar607/Drawspace / RectangleShapes

Function RectangleShapes

components/CanvasShapeRenderers.tsx:40–72  ·  view source on GitHub ↗
({
  rectangles,
  isPointerTool,
  onSelect,
  onDragEnd,
  onTransformEnd,
  registerRef,
  selectedShapeId,
}: RectangleShapesProps)

Source from the content-addressed store, hash-verified

38}
39
40export 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
74interface EllipseShapesProps {
75 ellipses: (EllipseShape & EllipseProperties)[];

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected