package labeling
import (
"github.com/pancsta/d2/lib/geo"
"github.com/pancsta/d2/d2layouts/d2talalayout/internal/labelgeom"
"github.com/pancsta/d2/d2layouts/d2talalayout/internal/layoutgraph"
)
type PositionedArrowheadLabel struct {
geo .Box
Edge *layoutgraph .Edge
IsTarget bool
Text string
}
func PositionArrowheadLabel (edge *layoutgraph .Edge , isTarget bool , route geo .Route ) *PositionedArrowheadLabel {
if edge == nil {
return nil
}
value := edge .SourceArrowheadLabel
if isTarget {
value = edge .TargetArrowheadLabel
}
if value == nil {
return nil
}
topLeft := labelgeom .ArrowheadTopLeft (
route ,
isTarget ,
string (edge .SourceArrowhead ),
string (edge .TargetArrowhead ),
value .Width ,
value .Height ,
)
return &PositionedArrowheadLabel {
Box : *geo .NewBox (topLeft , value .Width , value .Height ),
Edge : edge ,
IsTarget : isTarget ,
Text : value .Text ,
}
}
The pages are generated with Golds v0.8.7 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .