Example
const list = new List({
children: [
new Graphics().rect(0, 0, 50, 50).fill(0x000000),
new Graphics().rect(0, 0, 50, 50).fill(0xFFFFFF),
],
});
list.addChild(new Graphics().rect(0, 0, 50, 50)).fill(0x000000);
Extends
- Container
Members
Set bottom padding.
Get bottom padding.
Returns all arranged elements.
Set element margin.
Get element margin.
Set horizontal padding, overriding all left and right padding options.
Get horizontal padding.
Set left padding.
Get left padding.
Set width of area to fit elements when arrange. (If not set parent width will be used).
Get width of area to fit elements when arrange. (If not set parent width will be used).
Set padding, overriding all padding options.
Get padding.
Set right padding.
Get right padding.
Set top padding.
Get top padding.
Set items arrange direction.
Get items arrange direction.
Set vertical padding, overriding all top and bottom padding options.
Get vertical padding.
Width of area to fit elements when arrange. (If not set parent width will be used).
- Default Value:
- 0
Arrange direction. Defaults to 'bidirectional' for multi-column layout when type is not specified.
- Default Value:
- "bidirectional"
Set while a batch of children is being added, so the list is arranged once at the end.
- Default Value:
- false
Methods
Adds items to the list, arranging them once instead of once per item.
childAdded arranges the whole list on every single addChild, which makes adding
items one by one quadratic. Use this when adding more than one.
| Name | Type | Description |
|---|---|---|
items |
C[] |
items to add. |
Arrange all elements basing in their sizes and component options. Can be arranged vertically, horizontally or bidirectional.
Initiates list component.
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
{ type? : ListType } & C<ListOptions> |
<optional> |
Removes items from the list. (Does not destroy them)
| Name | Type | Description |
|---|---|---|
itemID |
number |
Item to remove (starting from 0). |
Arranges children unless a batch add is in progress, which arranges once at the end.
Distance between a child's position and the top left corner of the space it takes up.
It is zero for a plain container, and non-zero for anything positioned by a point
inside itself - an anchored Sprite, or a container with a pivot.
| Name | Type | Description |
|---|---|---|
child |
C |
the child to measure. |
Returns:
| Type | Description |
|---|---|
| { x : number, y : number } | the offset, in this list's coordinate space. |