Skip to content

Commit

Permalink
Merge pull request #1619 from gavin-ts/fix-dagre-id-registration
Browse files Browse the repository at this point in the history
Fix dagre id registration
  • Loading branch information
gavin-ts authored Sep 26, 2023
2 parents 88ac888 + 09d6245 commit ae128ac
Show file tree
Hide file tree
Showing 7 changed files with 638 additions and 1 deletion.
4 changes: 3 additions & 1 deletion d2layouts/d2dagrelayout/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
}

mapper := NewObjectMapper()
loadScript := ""
for _, obj := range g.Objects {
mapper.Register(obj)
}
loadScript := ""
for _, obj := range g.Objects {
loadScript += mapper.generateAddNodeLine(obj, int(obj.Width), int(obj.Height))
if obj.Parent != g.Root {
loadScript += mapper.generateAddParentLine(obj, obj.Parent)
Expand Down
1 change: 1 addition & 0 deletions e2etests/regression_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ cf many required: {
loadFromFile(t, "multiple_constant_nears"),
loadFromFile(t, "empty_nested_grid"),
loadFromFile(t, "code_font_size"),
loadFromFile(t, "disclaimer"),
}

runa(t, tcs)
Expand Down
16 changes: 16 additions & 0 deletions e2etests/testdata/files/disclaimer.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
vars: {
base-constraints: [NOT NULL; UNQ]
disclaimer: DISCLAIMER {
I am not a lawyer
near: top-center
}
}

data: {
shape: sql_table
a: int {constraint: [PK; ...${base-constraints}]}
}

custom-disclaimer: DRAFT DISCLAIMER {
...${disclaimer}
}
206 changes: 206 additions & 0 deletions e2etests/testdata/regression/disclaimer/dagre/board.exp.json

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

103 changes: 103 additions & 0 deletions e2etests/testdata/regression/disclaimer/dagre/sketch.exp.svg
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 ae128ac

Please sign in to comment.