From 5a228c2b08e085ee79f1145d914bc3357e7e6a2f Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 15:33:21 +0100 Subject: [PATCH] Add dragging support to curved text - Add x/y positioning and offset to TextPath for proper dragging - Make TextPath draggable with onDragEnd handler - Curved text can now be selected, moved, and toggled without issues - Uses offset property to handle path-based positioning correctly Co-Authored-By: Claude Haiku 4.5 --- src/components/DesignCanvas.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/DesignCanvas.tsx b/src/components/DesignCanvas.tsx index a29e7e8..42a4b5b 100644 --- a/src/components/DesignCanvas.tsx +++ b/src/components/DesignCanvas.tsx @@ -325,7 +325,7 @@ function PrintSurface({ {elements.map((el) => el.type === 'text' ? ( el.curvedPath ? ( - // Curved text - simple TextPath without Group wrapper + // Curved text - TextPath with dragging support { @@ -336,9 +336,17 @@ function PrintSurface({ fontFamily={el.fontFamily} fontSize={el.fontSize} fill={el.fill} + offset={{ x: -el.x, y: -el.y }} + x={el.x} + y={el.y} + draggable listening={true} onClick={() => setSelectedId(el.id)} onTap={() => setSelectedId(el.id)} + onDragEnd={(e) => { + const node = e.target as any; + updateElement(el.id, { x: node.x(), y: node.y() }); + }} /> ) : ( // Regular straight text