Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grid in constant near #1173

Merged
merged 4 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
#### Improvements 🧹

#### Bugfixes ⛑️

- Fixes grid layouts not applying on objects with a constant near [#1173](https://github.com/terrastruct/d2/issues/1173)
6 changes: 3 additions & 3 deletions d2lib/d2.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ func compile(ctx context.Context, g *d2graph.Graph, opts *CompileOptions) (*d2ta

constantNearGraphs := d2near.WithoutConstantNears(ctx, g)

layoutWithGrids := d2grid.Layout(ctx, g, coreLayout)

// run core layout for constantNears
for _, tempGraph := range constantNearGraphs {
if err = coreLayout(ctx, tempGraph); err != nil {
if err = layoutWithGrids(ctx, tempGraph); err != nil {
return nil, err
}
}

layoutWithGrids := d2grid.Layout(ctx, g, coreLayout)

err = d2sequence.Layout(ctx, g, layoutWithGrids)
if err != nil {
return nil, err
Expand Down
14 changes: 14 additions & 0 deletions e2etests/regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,20 @@ x -> y: sync
y -> z: sync {
style.bold: true
}
`,
},
{
name: "grid_in_constant_near",
script: `
a
b
c
x: {
near: top-right
grid-columns: 1
y
z
}
`,
},
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading