diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 0b86b6a15..d9ba8449b 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -229,37 +229,38 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s } case d2target.FilledCircleArrowhead: attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + radius := width / 2 if isTarget { - - path = fmt.Sprintf(``, + path = fmt.Sprintf(``, attrs, - (height/1.6)/strokeWidth*2, - (height/1.6)/strokeWidth*2, - (width/3.2)/strokeWidth*2, + radius+strokeWidth/2, + radius, + radius-strokeWidth/2, ) } else { - path = fmt.Sprintf(``, + path = fmt.Sprintf(``, attrs, - (height/1.6)/strokeWidth*2, - (height/1.6)/strokeWidth*2, - (width/3.2)/strokeWidth*2, + radius-strokeWidth/2, + radius, + radius-strokeWidth/2, ) } case d2target.CircleArrowhead: attrs := fmt.Sprintf(`class="connection" fill="white" stroke="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth) + radius := width / 2 if isTarget { path = fmt.Sprintf(``, attrs, - (height/1.6)/strokeWidth*2, - (height/1.6)/strokeWidth*2, - (width/3.2)/strokeWidth*2, + radius+strokeWidth/2, + radius, + radius-strokeWidth, ) } else { path = fmt.Sprintf(``, attrs, - (height/1.6)/strokeWidth*2, - (height/1.6)/strokeWidth*2, - (width/3.2)/strokeWidth*2, + radius-strokeWidth/2, + radius, + radius-strokeWidth, ) } @@ -309,7 +310,7 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s var refX float64 refY := height / 2 switch arrowhead { - case d2target.DiamondArrowhead, d2target.CircleArrowhead: + case d2target.DiamondArrowhead: if isTarget { refX = width - 0.6*strokeWidth } else { diff --git a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg index 33d49792e..60d459d6a 100644 --- a/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg +++ b/e2etests/testdata/stable/circle_arrowhead/dagre/sketch.exp.svg @@ -39,7 +39,7 @@ width="491" height="577" viewBox="-102 -102 491 577">