update renderDoubleOval function
This commit is contained in:
parent
fd7f30d1c3
commit
f1b7f2706d
2 changed files with 5 additions and 12 deletions
|
|
@ -134,23 +134,23 @@ func Oval(r *Runner, shape d2target.Shape) (string, error) {
|
|||
}
|
||||
|
||||
func DoubleOval(r *Runner, shape d2target.Shape) (string, error) {
|
||||
js_big_circle := fmt.Sprintf(`node = rc.ellipse(%d, %d, %d, %d, {
|
||||
jsBigCircle := fmt.Sprintf(`node = rc.ellipse(%d, %d, %d, %d, {
|
||||
fill: "%s",
|
||||
stroke: "%s",
|
||||
strokeWidth: %d,
|
||||
%s
|
||||
});`, shape.Width/2, shape.Height/2, shape.Width, shape.Height, shape.Fill, shape.Stroke, shape.StrokeWidth, baseRoughProps)
|
||||
js_small_circle := fmt.Sprintf(`node = rc.ellipse(%d, %d, %d, %d, {
|
||||
jsSmallCircle := fmt.Sprintf(`node = rc.ellipse(%d, %d, %d, %d, {
|
||||
fill: "%s",
|
||||
stroke: "%s",
|
||||
strokeWidth: %d,
|
||||
%s
|
||||
});`, shape.Width/2, shape.Height/2, shape.Width-15, shape.Height-15, shape.Fill, shape.Stroke, shape.StrokeWidth, baseRoughProps)
|
||||
paths_big_circle, err := computeRoughPaths(r, js_big_circle)
|
||||
paths_big_circle, err := computeRoughPaths(r, jsBigCircle)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
paths_small_circle, err := computeRoughPaths(r, js_small_circle)
|
||||
paths_small_circle, err := computeRoughPaths(r, jsSmallCircle)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -494,14 +494,7 @@ func renderOval(tl *geo.Point, width, height float64, style string) string {
|
|||
}
|
||||
|
||||
func renderDoubleCircle(tl *geo.Point, width, height float64, style string) string {
|
||||
rx := width / 2
|
||||
ry := height / 2
|
||||
cx := tl.X + rx
|
||||
cy := tl.Y + ry
|
||||
return fmt.Sprintf(`<ellipse class="shape" cx="%f" cy="%f" rx="%f" ry="%f" style="%s" />
|
||||
<ellipse class="shape" cx="%f" cy="%f" rx="%f" ry="%f" style="%s" />`,
|
||||
cx, cy, rx-2, ry-2, style,
|
||||
cx, cy, rx-10, ry-10, style)
|
||||
return renderOval(tl, width, height, style) + renderOval(&geo.Point{X: tl.X + 5, Y: tl.Y + 5}, width-10, height-10, style)
|
||||
}
|
||||
|
||||
func defineShadowFilter(writer io.Writer) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue