vchelaru / Gum

Flexible layout tool for creating UI on any platform

Home Page:http://gumui.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Auto Grid Children Layout Type

vchelaru opened this issue · comments

The Auto Grid layout type is a new type of layout which places each child in its own cell, similar to an evenly-spaced Grid. When the user selects an Auto Grid, 2 new Variables are shown:

  • Number Of Columns
  • Number Of Rows

The container will place its children according to their order, starting with the first at the top left. Each subsequent child will be added to the next row or column, depending on whether "Auto Grid Horizontal" or "Auto Grid Vertical" is selected.

Each row and column is evenly spaced - the user cannot change the width or height directly. The width or height depends on the overall container's width and height, divided by Number of Columns and Rows.

Children cannot occupy multiple rows or columns. Of course, children may be too large to fit inside a cell, so their bounds may spill over into adjacent cells. This will not affect sibling children cell index. Each child will be positioned according to the position of its cell.

Children of an Auto Grid container will treat their cell as their parent. Therefore, the following properties will use the cell rather than the entire container:

  • X and X Units
  • Y and Y Units
  • Width and Width Units
  • Height and Height Units

Therefore, if the user clicks on any Dock, the docking should be relative to the child's Cell.

A rotated parent should also rotate the cells it contains, so children within a rotated parent need to adjust their origins.

If a user adds more children than cells in a container, the behavior is undefined - the actual implementation should favor the simplest approach. This may result in children spilling over the container.

Parent containers which use AutoGrid should not be able to be sized by their children for this first implementation. Effectively a parent using its children for its Width and Height will behave as if the Absolute option is checked. In the future, the contents of cells may be used to determine the necessary size of the parent to prevent spillover, but this will not be implemented in this first version.