fix: only for none-zero border-radius rect

This commit is contained in:
donglixiaoche 2023-03-09 11:03:00 +08:00
parent 5994dea83a
commit b1ae2f520d
No known key found for this signature in database
GPG key ID: F235CD35048B3752
2 changed files with 8 additions and 4 deletions

View file

@ -93,8 +93,10 @@ func drawClass(writer io.Writer, targetShape d2target.Shape) {
el.Height = float64(targetShape.Height) el.Height = float64(targetShape.Height)
el.Fill, el.Stroke = d2themes.ShapeTheme(targetShape) el.Fill, el.Stroke = d2themes.ShapeTheme(targetShape)
el.Style = targetShape.CSSStyle() el.Style = targetShape.CSSStyle()
el.Rx = float64(targetShape.BorderRadius) if targetShape.BorderRadius != 0 {
el.Ry = float64(targetShape.BorderRadius) el.Rx = float64(targetShape.BorderRadius)
el.Ry = float64(targetShape.BorderRadius)
}
fmt.Fprint(writer, el.Render()) fmt.Fprint(writer, el.Render())
box := geo.NewBox( box := geo.NewBox(

View file

@ -121,8 +121,10 @@ func drawTable(writer io.Writer, targetShape d2target.Shape) {
rectEl.Fill, rectEl.Stroke = d2themes.ShapeTheme(targetShape) rectEl.Fill, rectEl.Stroke = d2themes.ShapeTheme(targetShape)
rectEl.ClassName = "shape" rectEl.ClassName = "shape"
rectEl.Style = targetShape.CSSStyle() rectEl.Style = targetShape.CSSStyle()
rectEl.Rx = float64(targetShape.BorderRadius) if targetShape.BorderRadius != 0 {
rectEl.Ry = float64(targetShape.BorderRadius) rectEl.Rx = float64(targetShape.BorderRadius)
rectEl.Ry = float64(targetShape.BorderRadius)
}
fmt.Fprint(writer, rectEl.Render()) fmt.Fprint(writer, rectEl.Render())
box := geo.NewBox( box := geo.NewBox(