You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering if it might be possible to add (optional) arrows to edges. Arrows can be great when implementing flow charts or indicating parent-child hierarchies.
The arrows should definitely be optional. They aren't the right thing for many use cases!
Perhaps it would be possible to define marker-end components and pass them into the edge, similar to how anchors are added to nodes.
There's some previous discussion about arrows here: #460.
The text was updated successfully, but these errors were encountered:
Yes it's possible to use the marker-start and marker-end attributes of SVG to do that.
I used this code to manually add arrows to edge:
<Edgelet:path><defs><!-- A marker to be used as an arrowhead --><markerid="arrow"
viewBox="0 0 10 10"
refX="11"
refY="5"
markerWidth="6"
markerHeight="6"
orient="auto-start-reverse"
><pathd="M 0 0 L 10 5 L 0 10 z" />
</marker></defs><pathd={path}marker-start={isBidirectional? 'url(#arrow)' : ''}
marker-end="url(#arrow)"
/>
</Edge>
Note: in this example, isBidirectional is used to toggle the marker.
The style can be set with the CSS variables provided by Svelvet (eg. stroke: var(--prop-edge-color, var(--edge-color, var(--default-edge-color)));)
I don't know if such a feature will find its way in Svelvet. In the meantime, I hope this example could be useful to someone ;)
Hello, thanks for the excellent library! 👋
I was wondering if it might be possible to add (optional) arrows to edges. Arrows can be great when implementing flow charts or indicating parent-child hierarchies.
The arrows should definitely be optional. They aren't the right thing for many use cases!
Perhaps it would be possible to define
marker-end
components and pass them into the edge, similar to how anchors are added to nodes.There's some previous discussion about arrows here: #460.
The text was updated successfully, but these errors were encountered: