fix sketch
|
|
@ -168,7 +168,7 @@ func DoubleRect(r *Runner, shape d2target.Shape) (string, error) {
|
|||
sketchOEl.SetTranslate(float64(shape.Pos.X), float64(shape.Pos.Y))
|
||||
sketchOEl.Width = float64(shape.Width)
|
||||
sketchOEl.Height = float64(shape.Height)
|
||||
renderedSO, err := d2themes.NewThemableSketchOverlay(sketchOEl, pathEl.Fill).Render()
|
||||
renderedSO, err := d2themes.NewThemableSketchOverlay(sketchOEl, shape.Fill).Render()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
|
@ -252,17 +252,27 @@ func DoubleOval(r *Runner, shape d2target.Shape) (string, error) {
|
|||
pathEl = d2themes.NewThemableElement("path")
|
||||
pathEl.SetTranslate(float64(shape.Pos.X), float64(shape.Pos.Y))
|
||||
pathEl.Fill, pathEl.Stroke = d2themes.ShapeTheme(shape)
|
||||
// No need for inner to double paint
|
||||
pathEl.Fill = "transparent"
|
||||
pathEl.ClassName = "shape"
|
||||
pathEl.Style = shape.CSSStyle()
|
||||
for _, p := range pathsSmallCircle {
|
||||
pathEl.D = p
|
||||
output += pathEl.Render()
|
||||
}
|
||||
soElement := d2themes.NewThemableElement("ellipse")
|
||||
soElement.SetTranslate(float64(shape.Pos.X+shape.Width/2), float64(shape.Pos.Y+shape.Height/2))
|
||||
soElement.Rx = float64(shape.Width / 2)
|
||||
soElement.Ry = float64(shape.Height / 2)
|
||||
renderedSO, err := d2themes.NewThemableSketchOverlay(
|
||||
soElement,
|
||||
shape.Fill,
|
||||
).Render()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
output += renderedSO
|
||||
|
||||
output += fmt.Sprintf(
|
||||
`<ellipse class="sketch-overlay" transform="translate(%d %d)" rx="%d" ry="%d" />`,
|
||||
shape.Pos.X+shape.Width/2, shape.Pos.Y+shape.Height/2, shape.Width/2, shape.Height/2,
|
||||
)
|
||||
return output, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 298 KiB |
|
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 288 KiB |
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 284 KiB |
|
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 274 KiB |
|
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 334 KiB |
|
Before Width: | Height: | Size: 297 KiB After Width: | Height: | Size: 325 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 218 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 279 KiB |
|
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 270 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 190 KiB After Width: | Height: | Size: 217 KiB |
|
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 240 KiB After Width: | Height: | Size: 267 KiB |
|
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 332 KiB |
|
Before Width: | Height: | Size: 296 KiB After Width: | Height: | Size: 323 KiB |
|
Before Width: | Height: | Size: 270 KiB After Width: | Height: | Size: 289 KiB |
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 340 KiB |
|
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 330 KiB |
|
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 228 KiB |
|
Before Width: | Height: | Size: 269 KiB After Width: | Height: | Size: 306 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 105 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 418 KiB |
|
Before Width: | Height: | Size: 400 KiB After Width: | Height: | Size: 418 KiB |
|
|
@ -1685,10 +1685,6 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
|
|||
// generate style elements that will be appended to the SVG tag
|
||||
upperBuf := &bytes.Buffer{}
|
||||
embedFonts(upperBuf, buf.String(), diagram.FontFamily) // embedFonts *must* run before `d2sketch.DefineFillPatterns`, but after all elements are appended to `buf`
|
||||
if sketchRunner != nil {
|
||||
d2sketch.DefineFillPatterns(upperBuf)
|
||||
}
|
||||
|
||||
themeStylesheet, err := themeCSS(themeID, darkThemeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -1705,6 +1701,9 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
|
|||
if hasMarkdown {
|
||||
fmt.Fprintf(upperBuf, `<style type="text/css">%s</style>`, mdCSS)
|
||||
}
|
||||
if sketchRunner != nil {
|
||||
d2sketch.DefineFillPatterns(upperBuf)
|
||||
}
|
||||
|
||||
// This shift is for background el to envelop the diagram
|
||||
left -= int(math.Ceil(float64(diagram.Root.StrokeWidth) / 2.))
|
||||
|
|
|
|||