Fix TextPath positioning - remove x/y coordinates

- TextPath positioning is handled by the path data, not x/y coordinates
- Removed x={el.x} and y={el.y} from TextPath to prevent coordinate corruption
- Removes drag handlers from TextPath since curves are centered on canvas
- Text now properly persists when toggling between curved and straight

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 15:19:24 +01:00
co-authored by Claude Haiku 4.5
parent 469ea49374
commit 6a1f4c7ca1
+1 -8
View File
@@ -325,7 +325,7 @@ function PrintSurface({
{elements.map((el) =>
el.type === 'text' ? (
el.curvedPath ? (
// Curved text path - directly draggable
// Curved text path - centered on canvas
<TextPath
key={el.id}
ref={(node) => {
@@ -336,16 +336,9 @@ function PrintSurface({
fontFamily={el.fontFamily}
fontSize={el.fontSize}
fill={el.fill}
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