diff --git a/d2compiler/compile.go b/d2compiler/compile.go index 1c2267a53..902384c1c 100644 --- a/d2compiler/compile.go +++ b/d2compiler/compile.go @@ -790,7 +790,7 @@ func (c *compiler) compileIconStyleField(attrs *d2graph.Attributes, f *d2ir.Fiel if f.Primary() == nil { return } - compileStyleFieldInit(attrs, f) + compileIconStyleFieldInit(attrs, f) scalar := f.Primary().Value err := attrs.IconStyle.Apply(f.Name.ScalarString(), scalar.ScalarString()) @@ -815,12 +815,7 @@ func compileStyleFieldInit(attrs *d2graph.Attributes, f *d2ir.Field) { case "stroke-dash": attrs.Style.StrokeDash = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} case "border-radius": - if attrs.Style.BorderRadius == nil { - attrs.Style.BorderRadius = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} - } - if attrs.IconStyle.BorderRadius == nil { - attrs.IconStyle.BorderRadius = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} - } + attrs.Style.BorderRadius = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} case "shadow": attrs.Style.Shadow = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} case "3d": @@ -858,6 +853,13 @@ func compileStyleFieldInit(attrs *d2graph.Attributes, f *d2ir.Field) { } } +func compileIconStyleFieldInit(attrs *d2graph.Attributes, f *d2ir.Field) { + switch f.Name.ScalarString() { + case "border-radius": + attrs.IconStyle.BorderRadius = &d2graph.Scalar{MapKey: f.LastPrimaryKey()} + } +} + func (c *compiler) compileEdge(obj *d2graph.Object, e *d2ir.Edge) { edge, err := obj.Connect(e.ID.SrcPath, e.ID.DstPath, e.ID.SrcArrow, e.ID.DstArrow, "") if err != nil { diff --git a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf index 3330e4b36..85be6ffc1 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/internal_linked_pdf.exp.pdf differ diff --git a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf index a68b49825..c636403be 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf differ diff --git a/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf index 33d13525d..aace2ad9c 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/renamed-board.exp.pdf differ diff --git a/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf b/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf index ccaf9c3be..7ecdb663f 100644 Binary files a/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf and b/e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf differ diff --git a/testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json b/testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json index e4f70e326..0d2ce8a0f 100644 --- a/testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json +++ b/testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json @@ -351,11 +351,7 @@ "value": "5" } }, - "iconStyle": { - "borderRadius": { - "value": "" - } - }, + "iconStyle": {}, "near_key": null, "shape": { "value": "rectangle" diff --git a/testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json b/testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json index 83d6ed6d5..7c87b9557 100644 --- a/testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json +++ b/testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json @@ -163,11 +163,7 @@ "value": "5" } }, - "iconStyle": { - "borderRadius": { - "value": "" - } - }, + "iconStyle": {}, "near_key": null, "shape": { "value": "rectangle"