Documentation
¶
Index ¶
- Constants
- func GenLayout(objects []*d2graph.Object, cutIndices []int) [][]*d2graph.Object
- func Layout(ctx context.Context, g *d2graph.Graph) error
- func PlaceCells(ctx context.Context, g *d2graph.Graph, router d2graph.RouteEdges) (fit func([]*d2graph.Edge), err error)
- func RouteEdges(ctx context.Context, _ *d2graph.Graph, edges []*d2graph.Edge) error
Constants ¶
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 )
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 PlaceCells ¶ added in v0.10.0
func PlaceCells(ctx context.Context, g *d2graph.Graph, router d2graph.RouteEdges) (fit func([]*d2graph.Edge), err error)
PlaceCells positions the cells and routes their direct edges. After nested diagrams have been restored and their cross-cell edges routed, call the returned function with those edges to size the container around the result.
Types ¶
This section is empty.