fix connection mask clipping along top and left edges of graph

This commit is contained in:
Gavin Nishizawa 2022-12-21 12:54:02 -08:00
parent ddcd6b5d54
commit 1434306948
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -1035,12 +1035,11 @@ func Render(diagram *d2target.Diagram, pad int) ([]byte, error) {
// Note: we always want this since we reference it on connections even if there end up being no masked labels
fmt.Fprint(buf, strings.Join([]string{
fmt.Sprintf(`<mask id="%s" maskUnits="userSpaceOnUse" x="0" y="0" width="%d" height="%d">`,
labelMaskID, w, h,
fmt.Sprintf(`<mask id="%s" maskUnits="userSpaceOnUse" x="%d" y="%d" width="%d" height="%d">`,
labelMaskID, -pad, -pad, w, h,
),
fmt.Sprintf(`<rect x="0" y="0" width="%d" height="%d" fill="white"></rect>`,
w,
h,
fmt.Sprintf(`<rect x="%d" y="%d" width="%d" height="%d" fill="white"></rect>`,
-pad, -pad, w, h,
),
strings.Join(labelMasks, "\n"),
`</mask>`,