context for manipulating icon's border-radius

This commit is contained in:
melsonic 2025-03-30 19:45:17 +05:30
parent e91f4dbc4a
commit 4414fcb7cb
No known key found for this signature in database
GPG key ID: DFA426742F621CD7

View file

@ -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))