Skip to content

Grid: improved layout #57

@casey-c

Description

@casey-c

At the moment, creating a grid puts every node in a straight line, from left to right. While this is a decent first step, we need a better algorithm for laying things out. So something like, if a region becomes too wide, see if the children can be put vertically stacked as well. This can be recursive too, so regions with many nodes can layout their individual areas but far higher up the tree it doesn't have to be adjusted.

This is kind of difficult to explain, so consider the following example. This graph:


       ┌─────────────────────────┐ 
 ┌───┐ │ ┌───┐ ┌───┐ ┌───┐ ┌───┐ │ 
 │ A │ │ │ P │ │ Q │ │ R │ │ S │ │ 
 └───┘ │ └───┘ └───┘ └───┘ └───┘ │ 
       └─────────────────────────┘ 

might be better off being drawn as

       ┌─────────────┐
 ┌───┐ │ ┌───┐ ┌───┐ │
 │ A │ │ │ P │ │ Q │ │
 └───┘ │ └───┘ └───┘ │
       │ ┌───┐ ┌───┐ │
       │ │ R │ │ S │ │
       │ └───┘ └───┘ │
       └─────────────┘

While this is too small of an example to really highlight why vertical stacking could be important, I hope it illustrates what I mean.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions