Fix curved text rendering - add x/y positioning and font properties

- Re-add x/y coordinates to TextPath for proper positioning within Group
- Add fontStyle and letterSpacing properties for complete font rendering
- Group remains draggable for movement
- Text content and font should now persist and render correctly when curves enabled

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 15:24:40 +01:00
co-authored by Claude Haiku 4.5
parent 9f6dcccaa8
commit 8509c1f08f
+10 -4
View File
@@ -325,26 +325,32 @@ function PrintSurface({
{elements.map((el) =>
el.type === 'text' ? (
el.curvedPath ? (
// Curved text path wrapped in draggable Group
// Curved text - render as separate path-based text
<Group
key={el.id}
ref={(node) => {
if (node) nodeRefs.current.set(el.id, node);
}}
x={el.x}
y={el.y}
draggable
listening={true}
onClick={() => setSelectedId(el.id)}
onTap={() => setSelectedId(el.id)}
onDragEnd={(e) => updateElement(el.id, { x: e.target.x(), y: e.target.y() })}
onDragEnd={(e) => {
const group = e.target;
// Update x/y based on the path offset
updateElement(el.id, { x: group.x(), y: group.y() });
}}
>
<TextPath
x={el.x}
y={el.y}
data={generateCurvePath(el.curvedPath.type, el.curvedPath.radius, el.curvedPath.reverse)}
text={el.text}
fontFamily={el.fontFamily}
fontSize={el.fontSize}
fill={el.fill}
fontStyle={el.fontStyle || 'normal'}
letterSpacing={el.letterSpacing || 0}
listening={false}
/>
</Group>