Circles Rendering closer to border. Still not perfect.
This commit is contained in:
parent
f21226bfa7
commit
75c0dee349
1 changed files with 12 additions and 9 deletions
|
|
@ -114,7 +114,10 @@ func arrowheadDimensions(arrowhead d2target.Arrowhead, strokeWidth float64) (wid
|
||||||
case d2target.DiamondArrowhead:
|
case d2target.DiamondArrowhead:
|
||||||
widthMultiplier = 11
|
widthMultiplier = 11
|
||||||
heightMultiplier = 9
|
heightMultiplier = 9
|
||||||
case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired, d2target.FilledCircleArrowhead, d2target.CircleArrowhead:
|
case d2target.FilledCircleArrowhead, d2target.CircleArrowhead:
|
||||||
|
widthMultiplier = 14
|
||||||
|
heightMultiplier = 14
|
||||||
|
case d2target.CfOne, d2target.CfMany, d2target.CfOneRequired, d2target.CfManyRequired:
|
||||||
widthMultiplier = 14
|
widthMultiplier = 14
|
||||||
heightMultiplier = 15
|
heightMultiplier = 15
|
||||||
}
|
}
|
||||||
|
|
@ -227,16 +230,16 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s
|
||||||
case d2target.FilledCircleArrowhead:
|
case d2target.FilledCircleArrowhead:
|
||||||
attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth)
|
attrs := fmt.Sprintf(`class="connection" fill="%s" stroke-width="%d"`, connection.Stroke, connection.StrokeWidth)
|
||||||
if isTarget {
|
if isTarget {
|
||||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
path = fmt.Sprintf(`<circle %s clip-path="circle()" cx="%f" cy="%f" r="%f"/>`,
|
||||||
attrs,
|
attrs,
|
||||||
width/2+5, height/2,
|
width-10.3+strokeWidth/3, height/2,
|
||||||
width/3,
|
width/2.9,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
path = fmt.Sprintf(`<circle %s clip-path="circle()" cx="%f" cy="%f" r="%f"/>`,
|
||||||
attrs,
|
attrs,
|
||||||
width/2-5, height/2,
|
width-19+strokeWidth/3, height/2,
|
||||||
width/3,
|
width/2.9,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
case d2target.CircleArrowhead:
|
case d2target.CircleArrowhead:
|
||||||
|
|
@ -244,13 +247,13 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection) s
|
||||||
if isTarget {
|
if isTarget {
|
||||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||||
attrs,
|
attrs,
|
||||||
width/2+5, height/2,
|
width/2+3.6+strokeWidth/3, height/2,
|
||||||
width/3.2,
|
width/3.2,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
path = fmt.Sprintf(`<circle %s cx="%f" cy="%f" r="%f"/>`,
|
||||||
attrs,
|
attrs,
|
||||||
width/2-5, height/2,
|
width/2-4.9+strokeWidth/3, height/2,
|
||||||
width/3.2,
|
width/3.2,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue