-
Notifications
You must be signed in to change notification settings - Fork 449
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
new grid layout with rows/columns #1122
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About the new d2grid/layout.go
file. This is something I try to do, but it may not be possible in some cases.
The first thing in the file is newGrid
, followed by Layout
, layoutGrid
and withoutGrids
But the order of the calls in Layout
, withoutGrids
, layoutGrid
and newGrid
. So, when reviewing/reading I had to keep going back and forth to find things. In general, I try to keep them in sequence as they are called. In some cases it makes it easier to follow/understand.
Another one is that, I think we should treat this as we do with clusters in TALA. Within a grid, nodes should have a standard size because of the symmetry it adds to the end result.
Should this handle nested grids? if so, can you add a test case?
Finally, I don't think I saw that no edges to descendants is enforced. If so, I think this is important to raise as an error in the compiler
@donglixiaoche wrote something similar here for edges: #1071 perhaps you could reuse that |
let's call these "Grid diagrams" https://discord.com/channels/1039184639652265985/1039184640285610147/1093008211600228484 can you make the appropriate namings in the code? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's name the keywords grid-columns
and grid-rows
to avoid parking another two common keywords, which especially could come up in sql tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't review algorithms too much, tested and played around with it and works great.
Thanks for the Dagger shoutout 😁❤️ |
Summary
Adds a new "grid diagram" layout to place nodes in rows and/or columns.
Use keyword
grid-rows: N
orgrid-columns: N
on a container to layout the container's children accordingly.Edges within grids, and containers in grids are not currently supported.
Details
grids can be created by settings rows or columns
layout will attempt to evenly place nodes into the number of rows or columns
with both rows and columns, each row's nodes will be the same height and each column's node the same width
ordering: if rows is set first, nodes will be placed along rows
if you add nodes exceeding the capacity, it is ok, it will just continue the same way
use rows: 3 + node width/height to build desired layout (new executive_grid test)
new teleport_grid test
new dagger_grid test