diff --git a/d2renderers/d2svg/class.go b/d2renderers/d2svg/class.go index acaaba3e1..1e69520d4 100644 --- a/d2renderers/d2svg/class.go +++ b/d2renderers/d2svg/class.go @@ -17,7 +17,7 @@ func classHeader(labelMaskID string, shape d2target.Shape, box *geo.Box, text st rectEl.Width, rectEl.Height = box.Width, box.Height rectEl.Fill = shape.Fill rectEl.ClassName = "class_header" - str := rectEl.RenderWithClipPath(fmt.Sprintf("%v-%v", labelMaskID, shape.ID)) + str := rectEl.RenderWithClipPath(fmt.Sprintf("%v-%v", labelMaskID, shape.ID), shape.BorderRadius != 0) if text != "" { tl := label.InsideMiddleCenter.GetPointOnBox( diff --git a/d2renderers/d2svg/table.go b/d2renderers/d2svg/table.go index 30d18aa85..3a5816f6e 100644 --- a/d2renderers/d2svg/table.go +++ b/d2renderers/d2svg/table.go @@ -46,7 +46,7 @@ func tableHeader(labelMaskID string, shape d2target.Shape, box *geo.Box, text st rectEl.Width, rectEl.Height = box.Width, box.Height rectEl.Fill = shape.Fill rectEl.ClassName = "class_header" - str := rectEl.RenderWithClipPath(fmt.Sprintf("%v-%v", labelMaskID, shape.ID)) + str := rectEl.RenderWithClipPath(fmt.Sprintf("%v-%v", labelMaskID, shape.ID), shape.BorderRadius != 0) if text != "" { tl := label.InsideMiddleLeft.GetPointOnBox( diff --git a/d2themes/element.go b/d2themes/element.go index b663b173f..d5b96e872 100644 --- a/d2themes/element.go +++ b/d2themes/element.go @@ -101,9 +101,11 @@ func (el *ThemableElement) SetMaskUrl(url string) { el.Mask = fmt.Sprintf("url(#%s)", url) } -func (el *ThemableElement) RenderWithClipPath(id string) string { +func (el *ThemableElement) RenderWithClipPath(id string, shouldAddClipPath bool) string { out := el.Render() - out = strings.Replace(out, "/>", fmt.Sprintf(`clip-path="url(#%v)" />`, id), 1) + if shouldAddClipPath { + out = strings.Replace(out, "/>", fmt.Sprintf(`clip-path="url(#%v)" />`, id), 1) + } return out }