consider stroke width

This commit is contained in:
Alexander Wang 2025-02-04 06:25:28 -07:00
parent 8f70000242
commit a12ad500ce
No known key found for this signature in database
GPG key ID: BE3937D0D52D8927
3 changed files with 13 additions and 10 deletions

View file

@ -310,6 +310,7 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection, i
width, 0.,
)
}
path = polygonEl.Render()
case d2target.BoxArrowhead:
polygonEl := d2themes.NewThemableElement("polygon", inlineTheme)
@ -317,20 +318,22 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection, i
polygonEl.Fill = d2target.BG_COLOR
polygonEl.Stroke = connection.Stroke
polygonEl.Attributes = fmt.Sprintf(`stroke-width="%d"`, connection.StrokeWidth)
polygonEl.Style = fmt.Sprintf("%sstroke-linejoin:miter;", polygonEl.Style)
inset := strokeWidth / 2
if isTarget {
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
0., 0.,
0., height,
width, height,
width, 0.,
inset, inset,
inset, height-inset,
width-inset, height-inset,
width-inset, inset,
)
} else {
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
0., 0.,
0., height,
width, height,
width, 0.,
inset, inset,
inset, height-inset,
width-inset, height-inset,
width-inset, inset,
)
}
path = polygonEl.Render()

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB