Fix open arrow marker using fill color from edge instead of none

This commit is contained in:
Alessandro
2025-08-18 12:44:49 +02:00
parent 73c3898dd0
commit f2bbdba33a
4 changed files with 7 additions and 8 deletions
+1 -1
View File
@@ -267,7 +267,7 @@ const edgeTypes: EdgeTypes = {
const defaultEdgeOptions = { const defaultEdgeOptions = {
markerEnd: { markerEnd: {
type: MarkerType.ArrowClosed, type: MarkerType.Arrow,
color: 'red', color: 'red',
width: 20, width: 20,
height: 20, height: 20,
@@ -216,7 +216,7 @@
const defaultEdgeOptions = { const defaultEdgeOptions = {
markerEnd: { markerEnd: {
type: MarkerType.ArrowClosed, type: MarkerType.Arrow,
color: 'red', color: 'red',
width: 20, width: 20,
height: 20 height: 20
@@ -8,7 +8,7 @@ type SymbolProps = Omit<EdgeMarker, 'type'>;
const ArrowSymbol = ({ color = 'none', strokeWidth = 1 }: SymbolProps) => { const ArrowSymbol = ({ color = 'none', strokeWidth = 1 }: SymbolProps) => {
const style = { const style = {
strokeWidth, strokeWidth,
...(color && { stroke: color }), ...(color && { stroke: color, fill: 'none' }),
}; };
return <polyline style={style} strokeLinecap="round" strokeLinejoin="round" fill="none" points="-5,-4 0,0 -5,4" />; return <polyline style={style} strokeLinecap="round" strokeLinejoin="round" fill="none" points="-5,-4 0,0 -5,4" />;
@@ -11,9 +11,6 @@
color = 'none', color = 'none',
strokeWidth strokeWidth
}: MarkerProps = $props(); }: MarkerProps = $props();
// Create inline styles when explicit color is provided
const polylineStyle = color ? `stroke: ${color}; fill: ${color};` : '';
</script> </script>
<marker <marker
@@ -29,7 +26,8 @@
> >
{#if type === MarkerType.Arrow} {#if type === MarkerType.Arrow}
<polyline <polyline
style={polylineStyle} style:stroke={color}
style:fill={'none'}
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
stroke-width={strokeWidth} stroke-width={strokeWidth}
@@ -38,7 +36,8 @@
/> />
{:else if type === MarkerType.ArrowClosed} {:else if type === MarkerType.ArrowClosed}
<polyline <polyline
style={polylineStyle} style:stroke={color}
style:fill={color}
stroke-linecap="round" stroke-linecap="round"
stroke-linejoin="round" stroke-linejoin="round"
stroke-width={strokeWidth} stroke-width={strokeWidth}