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

Fix grid rows gap bug #1646

Merged
merged 5 commits into from
Oct 6, 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
1 change: 1 addition & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@

#### Bugfixes ⛑️

- Fixes a bug calculating grid height with only grid-rows and different horizontal-gap and vertical-gap values. [#1646](https://github.com/terrastruct/d2/pull/1646)
- Grid layout now accounts for each cell's outside labels and icons [#1624](https://github.com/terrastruct/d2/pull/1624)
2 changes: 1 addition & 1 deletion d2layouts/d2grid/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (gd *gridDiagram) layoutDynamic(g *d2graph.Graph, obj *d2graph.Object) {
cursor.X = 0
cursor.Y += rowHeight + verticalGap
}
maxY = cursor.Y - horizontalGap
maxY = cursor.Y - verticalGap
} else {
// measure column heights
colHeights := []float64{}
Expand Down
1 change: 1 addition & 0 deletions e2etests/regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ cf many required: {
loadFromFile(t, "empty_nested_grid"),
loadFromFile(t, "code_font_size"),
loadFromFile(t, "disclaimer"),
loadFromFile(t, "grid_rows_gap_bug"),
}

runa(t, tcs)
Expand Down
8 changes: 8 additions & 0 deletions e2etests/testdata/files/grid_rows_gap_bug.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
grid: "" {
grid-rows: 3
horizontal-gap: 100
vertical-gap: 0
first
second
third
}
212 changes: 212 additions & 0 deletions e2etests/testdata/regression/grid_rows_gap_bug/dagre/board.exp.json

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

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading