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