From 4414fcb7cbfb37336509c81fee0424009dd2aed0 Mon Sep 17 00:00:00 2001 From: melsonic Date: Sun, 30 Mar 2025 19:45:17 +0530 Subject: [PATCH] context for manipulating icon's border-radius --- d2renderers/d2svg/d2svg.go | 1 + 1 file changed, 1 insertion(+) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 35b76befe..abc21d00b 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -1331,6 +1331,7 @@ func drawShape(writer, appendixWriter io.Writer, diagramHash string, targetShape } var iconClipPathID string if targetShape.IconBorderRadius != 0 && (targetShape.Type == d2target.ShapeImage) { + // Set the icon's border-radius to half of it's smaller dimension in case it exceeds that // https://www.w3.org/Style/CSS/Tracker/issues/29?changelog targetShape.IconBorderRadius = min(targetShape.IconBorderRadius, min(targetShape.Width, targetShape.Height)/2) iconClipPathID = fmt.Sprintf("%v-%v-icon", diagramHash, svg.SVGID(targetShape.ID))