fix: should add clipPath
This commit is contained in:
parent
dd1824c4dc
commit
77e2a23b2b
3 changed files with 6 additions and 4 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
if shouldAddClipPath {
|
||||
out = strings.Replace(out, "/>", fmt.Sprintf(`clip-path="url(#%v)" />`, id), 1)
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue