removed blank lines & capitalized ID's
This commit is contained in:
parent
38508cb12b
commit
5ce77a1325
5 changed files with 8 additions and 10 deletions
|
|
@ -766,11 +766,9 @@ func (c *compiler) compileStyleField(styles *d2graph.Style, f *d2ir.Field) {
|
|||
if f.Primary() == nil {
|
||||
return
|
||||
}
|
||||
|
||||
compileStyleFieldInit(styles, f)
|
||||
scalar := f.Primary().Value
|
||||
err := styles.Apply(f.Name.ScalarString(), scalar.ScalarString())
|
||||
|
||||
if err != nil {
|
||||
c.errorf(scalar, err.Error())
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1441,9 +1441,9 @@ func drawShape(writer, appendixWriter io.Writer, diagramHash string, targetShape
|
|||
el.Stroke = stroke
|
||||
el.Style = style
|
||||
if targetShape.IconBorderRadius != 0 {
|
||||
clipPathId := fmt.Sprintf("%v-%v-icon", diagramHash, svg.SVGID(targetShape.ID))
|
||||
fmt.Fprint(writer, applyIconBorderRadius(clipPathId, targetShape))
|
||||
el.ClipPath = clipPathId
|
||||
clipPathID := fmt.Sprintf("%v-%v-icon", diagramHash, svg.SVGID(targetShape.ID))
|
||||
fmt.Fprint(writer, applyIconBorderRadius(clipPathID, targetShape))
|
||||
el.ClipPath = clipPathID
|
||||
}
|
||||
fmt.Fprint(writer, el.Render())
|
||||
|
||||
|
|
@ -1877,7 +1877,7 @@ func drawShape(writer, appendixWriter io.Writer, diagramHash string, targetShape
|
|||
return labelMask, nil
|
||||
}
|
||||
|
||||
func applyIconBorderRadius(clipPathId string, shape d2target.Shape) string {
|
||||
func applyIconBorderRadius(clipPathID string, shape d2target.Shape) string {
|
||||
box := geo.NewBox(
|
||||
geo.NewPoint(float64(shape.Pos.X), float64(shape.Pos.Y)),
|
||||
float64(shape.Width),
|
||||
|
|
@ -1885,7 +1885,7 @@ func applyIconBorderRadius(clipPathId string, shape d2target.Shape) string {
|
|||
)
|
||||
topX, topY := box.TopLeft.X+box.Width, box.TopLeft.Y
|
||||
|
||||
out := fmt.Sprintf(`<clipPath id="%s">`, clipPathId)
|
||||
out := fmt.Sprintf(`<clipPath id="%s">`, clipPathID)
|
||||
out += fmt.Sprintf(`<path d="M %f %f L %f %f S %f %f %f %f `, box.TopLeft.X, box.TopLeft.Y+float64(shape.IconBorderRadius), box.TopLeft.X, box.TopLeft.Y+float64(shape.IconBorderRadius), box.TopLeft.X, box.TopLeft.Y, box.TopLeft.X+float64(shape.IconBorderRadius), box.TopLeft.Y)
|
||||
out += fmt.Sprintf(`L %f %f L %f %f `, box.TopLeft.X+box.Width-float64(shape.IconBorderRadius), box.TopLeft.Y, topX-float64(shape.IconBorderRadius), topY)
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ func clipPathForBorderRadius(diagramHash string, shape d2target.Shape) string {
|
|||
)
|
||||
topX, topY := box.TopLeft.X+box.Width, box.TopLeft.Y
|
||||
|
||||
out := fmt.Sprintf(`<clipPath id="%v-%v">`, diagramHash, shape.ID)
|
||||
out := fmt.Sprintf(`<clipPath id="%v-%v">`, diagramHash, svg.SVGID(shape.ID))
|
||||
out += fmt.Sprintf(`<path d="M %f %f L %f %f S %f %f %f %f `, box.TopLeft.X, box.TopLeft.Y+float64(shape.BorderRadius), box.TopLeft.X, box.TopLeft.Y+float64(shape.BorderRadius), box.TopLeft.X, box.TopLeft.Y, box.TopLeft.X+float64(shape.BorderRadius), box.TopLeft.Y)
|
||||
out += fmt.Sprintf(`L %f %f L %f %f `, box.TopLeft.X+box.Width-float64(shape.BorderRadius), box.TopLeft.Y, topX-float64(shape.BorderRadius), topY)
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Loading…
Reference in a new issue