render arrowhead labels using style.font-color
This commit is contained in:
parent
eef0331199
commit
cfd7c3996d
2 changed files with 15 additions and 0 deletions
|
|
@ -213,6 +213,9 @@ func toConnection(edge *d2graph.Edge, theme *d2themes.Theme) d2target.Connection
|
||||||
LabelWidth: edge.SrcArrowhead.LabelDimensions.Width,
|
LabelWidth: edge.SrcArrowhead.LabelDimensions.Width,
|
||||||
LabelHeight: edge.SrcArrowhead.LabelDimensions.Height,
|
LabelHeight: edge.SrcArrowhead.LabelDimensions.Height,
|
||||||
}
|
}
|
||||||
|
if edge.SrcArrowhead.Style.FontColor != nil {
|
||||||
|
connection.SrcLabel.Color = edge.SrcArrowhead.Style.FontColor.Value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if edge.DstArrow {
|
if edge.DstArrow {
|
||||||
|
|
@ -228,6 +231,9 @@ func toConnection(edge *d2graph.Edge, theme *d2themes.Theme) d2target.Connection
|
||||||
LabelWidth: edge.DstArrowhead.LabelDimensions.Width,
|
LabelWidth: edge.DstArrowhead.LabelDimensions.Width,
|
||||||
LabelHeight: edge.DstArrowhead.LabelDimensions.Height,
|
LabelHeight: edge.DstArrowhead.LabelDimensions.Height,
|
||||||
}
|
}
|
||||||
|
if edge.DstArrowhead.Style.FontColor != nil {
|
||||||
|
connection.DstLabel.Color = edge.DstArrowhead.Style.FontColor.Value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if theme != nil && theme.SpecialRules.NoCornerRadius {
|
if theme != nil && theme.SpecialRules.NoCornerRadius {
|
||||||
|
|
|
||||||
|
|
@ -613,6 +613,15 @@ func renderArrowheadLabel(connection d2target.Connection, text string, isDst boo
|
||||||
textEl.X = baselineCenter.X
|
textEl.X = baselineCenter.X
|
||||||
textEl.Y = baselineCenter.Y
|
textEl.Y = baselineCenter.Y
|
||||||
textEl.Fill = d2target.FG_COLOR
|
textEl.Fill = d2target.FG_COLOR
|
||||||
|
if isDst {
|
||||||
|
if connection.DstLabel.Color != "" {
|
||||||
|
textEl.Fill = connection.DstLabel.Color
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if connection.SrcLabel.Color != "" {
|
||||||
|
textEl.Fill = connection.SrcLabel.Color
|
||||||
|
}
|
||||||
|
}
|
||||||
textEl.ClassName = "text-italic"
|
textEl.ClassName = "text-italic"
|
||||||
textEl.Style = fmt.Sprintf("text-anchor:middle;font-size:%vpx", connection.FontSize)
|
textEl.Style = fmt.Sprintf("text-anchor:middle;font-size:%vpx", connection.FontSize)
|
||||||
textEl.Content = RenderText(text, textEl.X, height)
|
textEl.Content = RenderText(text, textEl.X, height)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue