a bit refactoring on icom style field init
This commit is contained in:
parent
eb4f36102a
commit
a2ce0c293e
7 changed files with 11 additions and 17 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Binary file not shown.
BIN
e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf
vendored
BIN
e2etests-cli/testdata/TestCLI_E2E/no-nav-pdf.exp.pdf
vendored
Binary file not shown.
Binary file not shown.
BIN
e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf
vendored
BIN
e2etests-cli/testdata/TestCLI_E2E/theme-pdf.exp.pdf
vendored
Binary file not shown.
6
testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json
generated
vendored
6
testdata/d2compiler/TestCompile2/vars/basic/quoted-var.exp.json
generated
vendored
|
|
@ -351,11 +351,7 @@
|
|||
"value": "5"
|
||||
}
|
||||
},
|
||||
"iconStyle": {
|
||||
"borderRadius": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"iconStyle": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
|
|
|
|||
6
testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json
generated
vendored
6
testdata/d2oracle/TestMove/into_container_with_flat_style.exp.json
generated
vendored
|
|
@ -163,11 +163,7 @@
|
|||
"value": "5"
|
||||
}
|
||||
},
|
||||
"iconStyle": {
|
||||
"borderRadius": {
|
||||
"value": ""
|
||||
}
|
||||
},
|
||||
"iconStyle": {},
|
||||
"near_key": null,
|
||||
"shape": {
|
||||
"value": "rectangle"
|
||||
|
|
|
|||
Loading…
Reference in a new issue