Documentation ¶
Index ¶
Constants ¶
View Source
const ( // don't consider layouts with rows longer than targetSize*1.2 or shorter than targetSize/1.2 STARTING_THRESHOLD = 1.2 // next try layouts with a 25% larger threshold THRESHOLD_STEP_SIZE = 0.25 MIN_THRESHOLD_ATTEMPTS = 1 MAX_THRESHOLD_ATTEMPTS = 3 ATTEMPT_LIMIT = 100_000 SKIP_LIMIT = 10_000_000 )
View Source
const ( CONTAINER_PADDING = 60 DEFAULT_GAP = 40 )
Variables ¶
This section is empty.
Functions ¶
func GenLayout ¶
generate a grid of objects from the given cut indices each cut index applies after the object at that index e.g. [0 1 2 3 4 5 6 7] with cutIndices [0, 2, 6] => [[0], [1, 2], [3,4,5,6], [7]]
func Layout ¶
func Layout(ctx context.Context, g *d2graph.Graph, layout d2graph.LayoutGraph) d2graph.LayoutGraph
Layout runs the grid layout on containers with rows/columns Note: children are not allowed edges or descendants
1. Traverse graph from root, skip objects with no rows/columns 2. Construct a grid with the container children 3. Remove the children from the main graph 4. Run grid layout 5. Set the resulting dimensions to the main graph shape 6. Run core layouts (without grid children) 7. Put grid children back in correct location
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.