This commit is contained in:
Alexander Wang 2023-02-27 19:17:19 -08:00
parent 48593357a5
commit 6d7188a3c8
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
3 changed files with 71 additions and 4 deletions

View file

@ -155,6 +155,8 @@ func DoubleRect(r *Runner, shape d2target.Shape) (string, error) {
pathEl = d2themes.NewThemableElement("path")
pathEl.SetTranslate(float64(shape.Pos.X+d2target.INNER_BORDER_OFFSET), float64(shape.Pos.Y+d2target.INNER_BORDER_OFFSET))
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 pathsSmallRect {
@ -162,10 +164,16 @@ func DoubleRect(r *Runner, shape d2target.Shape) (string, error) {
output += pathEl.Render()
}
output += fmt.Sprintf(
`<rect class="sketch-overlay" transform="translate(%d %d)" width="%d" height="%d" />`,
shape.Pos.X, shape.Pos.Y, shape.Width, shape.Height,
)
sketchOEl := d2themes.NewThemableElement("rect")
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()
if err != nil {
return "", err
}
output += renderedSO
return output, nil
}

View file

@ -986,6 +986,23 @@ company Warehouse.explanation: |md
- Staging
- Dispatch to Site
|
`,
},
{
name: "double-border",
script: `a: {
style.double-border: true
b
}
c: {
shape: oval
style.double-border: true
d
}
normal: {
nested normal
}
something
`,
},
}

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 270 KiB