cleanup
This commit is contained in:
parent
4dfd5d960d
commit
8d2636a147
1 changed files with 42 additions and 52 deletions
|
|
@ -494,11 +494,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
|||
|
||||
// if an edge runs into an outside label, stop the edge at the label instead
|
||||
overlapsOutsideLabel := false
|
||||
switch srcShape.GetType() {
|
||||
case shape.TEXT_TYPE, shape.TABLE_TYPE, shape.CLASS_TYPE, shape.CODE_TYPE:
|
||||
// labels aren't actually labels
|
||||
default:
|
||||
if edge.Src.Label.Value != "" {
|
||||
if edge.Src.HasLabel() {
|
||||
// assumes LabelPosition, LabelWidth, LabelHeight are all set if there is a label
|
||||
labelPosition := label.Position(*edge.Src.LabelPosition)
|
||||
if labelPosition.IsOutside() {
|
||||
|
|
@ -524,18 +520,13 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !overlapsOutsideLabel {
|
||||
// trace the edge to the specific shape's border
|
||||
points[startIndex] = shape.TraceToShapeBorder(srcShape, start, points[startIndex+1])
|
||||
}
|
||||
|
||||
overlapsOutsideLabel = false
|
||||
switch dstShape.GetType() {
|
||||
case shape.TEXT_TYPE, shape.TABLE_TYPE, shape.CLASS_TYPE, shape.CODE_TYPE:
|
||||
// labels aren't actually labels
|
||||
default:
|
||||
if edge.Dst.Label.Value != "" {
|
||||
if edge.Dst.HasLabel() {
|
||||
// assumes LabelPosition, LabelWidth, LabelHeight are all set if there is a label
|
||||
labelPosition := label.Position(*edge.Dst.LabelPosition)
|
||||
if labelPosition.IsOutside() {
|
||||
|
|
@ -561,7 +552,6 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if !overlapsOutsideLabel {
|
||||
points[endIndex] = shape.TraceToShapeBorder(dstShape, end, points[endIndex-1])
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue