Skip to content

Commit

Permalink
Merge pull request #1646 from gavin-ts/fix-grid-rows-gap-bug
Browse files Browse the repository at this point in the history
Fix grid rows gap bug
  • Loading branch information
gavin-ts authored Oct 6, 2023
2 parents 65fd4b7 + 5b4818a commit db126ab
Show file tree
Hide file tree
Showing 12 changed files with 1,002 additions and 374 deletions.
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

0 comments on commit db126ab

Please sign in to comment.