fix: default border-radius for BaseConnection
This commit is contained in:
parent
776b6af1bc
commit
e88c60fe55
3 changed files with 7 additions and 11 deletions
|
|
@ -208,8 +208,6 @@ func toConnection(edge *d2graph.Edge) d2target.Connection {
|
|||
|
||||
if edge.Attributes.Style.BorderRadius != nil {
|
||||
connection.BorderRadius, _ = strconv.ParseFloat(edge.Attributes.Style.BorderRadius.Value, 64)
|
||||
} else {
|
||||
connection.BorderRadius = -1
|
||||
}
|
||||
|
||||
if edge.Attributes.Style.Opacity != nil {
|
||||
|
|
|
|||
|
|
@ -421,9 +421,6 @@ func pathData(connection d2target.Connection, srcAdj, dstAdj *geo.Point) string
|
|||
dist := geo.EuclideanDistance(prevTarget.X, prevTarget.Y, currTarget.X, currTarget.Y)
|
||||
|
||||
connectionBorderRadius := connection.BorderRadius
|
||||
if connectionBorderRadius < 0 {
|
||||
connectionBorderRadius = 10
|
||||
}
|
||||
units := math.Min(connectionBorderRadius, dist/2)
|
||||
|
||||
prevTranslations := prevVector.Unit().Multiply(units).ToPoint()
|
||||
|
|
|
|||
|
|
@ -316,12 +316,13 @@ type Connection struct {
|
|||
|
||||
func BaseConnection() *Connection {
|
||||
return &Connection{
|
||||
SrcArrow: NoArrowhead,
|
||||
DstArrow: NoArrowhead,
|
||||
Route: make([]*geo.Point, 0),
|
||||
Opacity: 1,
|
||||
StrokeDash: 0,
|
||||
StrokeWidth: 2,
|
||||
SrcArrow: NoArrowhead,
|
||||
DstArrow: NoArrowhead,
|
||||
Route: make([]*geo.Point, 0),
|
||||
Opacity: 1,
|
||||
StrokeDash: 0,
|
||||
StrokeWidth: 2,
|
||||
BorderRadius: 10,
|
||||
Text: Text{
|
||||
Italic: true,
|
||||
FontFamily: "DEFAULT",
|
||||
|
|
|
|||
Loading…
Reference in a new issue