feat(examples): add custom edge closes #193

This commit is contained in:
moklick
2020-05-11 22:05:50 +02:00
parent 6ea206e3be
commit 4af6261771
3 changed files with 29 additions and 11 deletions
+16
View File
@@ -0,0 +1,16 @@
import React from 'react';
export default function CustomEdge({
id, sourceX, sourceY, targetX, targetY, label, style = {}
}) {
return (
<>
<path id={id} style={style} className="react-flow__edge-path" d={`M ${sourceX},${sourceY}L ${targetX},${targetY}`} />
<text>
<textPath href={`#${id}`} style={{ fontSize: '12px' }} startOffset="50%" textAnchor="middle">
{label}
</textPath>
</text>
</>
);
};