consider stroke width
This commit is contained in:
parent
8f70000242
commit
a12ad500ce
3 changed files with 13 additions and 10 deletions
|
|
@ -310,6 +310,7 @@ func arrowheadMarker(isTarget bool, id string, connection d2target.Connection, i
|
||||||
width, 0.,
|
width, 0.,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
path = polygonEl.Render()
|
path = polygonEl.Render()
|
||||||
case d2target.BoxArrowhead:
|
case d2target.BoxArrowhead:
|
||||||
polygonEl := d2themes.NewThemableElement("polygon", inlineTheme)
|
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.Fill = d2target.BG_COLOR
|
||||||
polygonEl.Stroke = connection.Stroke
|
polygonEl.Stroke = connection.Stroke
|
||||||
polygonEl.Attributes = fmt.Sprintf(`stroke-width="%d"`, connection.StrokeWidth)
|
polygonEl.Attributes = fmt.Sprintf(`stroke-width="%d"`, connection.StrokeWidth)
|
||||||
|
polygonEl.Style = fmt.Sprintf("%sstroke-linejoin:miter;", polygonEl.Style)
|
||||||
|
|
||||||
|
inset := strokeWidth / 2
|
||||||
if isTarget {
|
if isTarget {
|
||||||
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
|
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
|
||||||
0., 0.,
|
inset, inset,
|
||||||
0., height,
|
inset, height-inset,
|
||||||
width, height,
|
width-inset, height-inset,
|
||||||
width, 0.,
|
width-inset, inset,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
|
polygonEl.Points = fmt.Sprintf("%f,%f %f,%f %f,%f %f,%f",
|
||||||
0., 0.,
|
inset, inset,
|
||||||
0., height,
|
inset, height-inset,
|
||||||
width, height,
|
width-inset, height-inset,
|
||||||
width, 0.,
|
width-inset, inset,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
path = polygonEl.Render()
|
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 |
Loading…
Reference in a new issue