cleanup
This commit is contained in:
parent
cee6a92722
commit
31252e6752
1 changed files with 19 additions and 23 deletions
|
|
@ -163,31 +163,27 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
|
||||||
|
|
||||||
// We can now run layout with accurate sizes of nested layout containers
|
// We can now run layout with accurate sizes of nested layout containers
|
||||||
// Layout according to the type of diagram
|
// Layout according to the type of diagram
|
||||||
LayoutDiagram := func(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, coreLayout d2graph.LayoutGraph) error {
|
var err error
|
||||||
var err error
|
switch graphInfo.DiagramType {
|
||||||
switch graphInfo.DiagramType {
|
case GridDiagram:
|
||||||
case GridDiagram:
|
log.Debug(ctx, "layout grid", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
||||||
log.Debug(ctx, "layout grid", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
if err = d2grid.Layout(ctx, g); err != nil {
|
||||||
if err = d2grid.Layout(ctx, g); err != nil {
|
return err
|
||||||
return err
|
}
|
||||||
}
|
|
||||||
|
case SequenceDiagram:
|
||||||
case SequenceDiagram:
|
log.Debug(ctx, "layout sequence", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
||||||
log.Debug(ctx, "layout sequence", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
err = d2sequence.Layout(ctx, g, coreLayout)
|
||||||
err = d2sequence.Layout(ctx, g, coreLayout)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
}
|
||||||
}
|
default:
|
||||||
default:
|
log.Debug(ctx, "default layout", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
||||||
log.Debug(ctx, "default layout", slog.F("rootlevel", g.RootLevel), slog.F("shapes", g.PrintString()))
|
err := coreLayout(ctx, g)
|
||||||
err := coreLayout(ctx, g)
|
if err != nil {
|
||||||
if err != nil {
|
return err
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
err := LayoutDiagram(ctx, g, graphInfo, coreLayout)
|
|
||||||
|
|
||||||
if len(constantNears) > 0 {
|
if len(constantNears) > 0 {
|
||||||
err := d2near.Layout(ctx, g, constantNears)
|
err := d2near.Layout(ctx, g, constantNears)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue