Packagefeathers.layout
Classpublic class TiledColumnsLayout
InheritanceTiledColumnsLayout Inheritance BaseTiledLayout Inheritance starling.events.EventDispatcher
Implements IVirtualLayout

Product Version : Feathers 1.0.0

Positions items as tiles (equal width and height) from top to bottom in multiple columns. Constrained to the suggested height, the tiled columns layout will change in width as the number of items increases or decreases.

See also

How to use TiledColumnsLayout with Feathers containers


Public Properties
 PropertyDefined By
  distributeHeights : Boolean
[override] If the total height of the tiles in a column (minus padding and gap) does not fill the entire column, the remaining space will be distributed to each tile equally.
TiledColumnsLayout
  distributeWidths : Boolean
[override] If the total width of the tiles in a row (minus padding and gap) does not fill the entire row, the remaining space will be distributed to each tile equally.
TiledColumnsLayout
 Inheritedgap : Number
Quickly sets both horizontalGap and verticalGap to the same value.
BaseTiledLayout
 InheritedhorizontalAlign : String
If the total row width is less than the bounds, the items in the row can be aligned horizontally.
BaseTiledLayout
 InheritedhorizontalGap : Number
The horizontal space, in pixels, between tiles.
BaseTiledLayout
 Inheritedpadding : Number
Quickly sets all padding properties to the same value.
BaseTiledLayout
 InheritedpaddingBottom : Number
The space, in pixels, below the items.
BaseTiledLayout
 InheritedpaddingLeft : Number
The space, in pixels, to the left of the items.
BaseTiledLayout
 InheritedpaddingRight : Number
The space, in pixels, to the right of the items.
BaseTiledLayout
 InheritedpaddingTop : Number
The space, in pixels, above of items.
BaseTiledLayout
  paging : String
[override] If the total combined width of the columns is larger than the width of the view port, the layout will be split into pages where each page is filled with the maximum number of columns that may be displayed without cutting off any items.
TiledColumnsLayout
  requestedColumnCount : int
[override] Requests that the layout uses a specific number of columns, if possible.
TiledColumnsLayout
  requestedRowCount : int
[override] Requests that the layout uses a specific number of rows in a column, if possible.
TiledColumnsLayout
 InheritedrequiresLayoutOnScroll : Boolean
[read-only] Determines if the container calls layout() when the scroll position changes.
BaseTiledLayout
 InheritedresetTypicalItemDimensionsOnMeasure : Boolean
If set to true, the width and height of the typicalItem will be reset to typicalItemWidth and typicalItemHeight, respectively, whenever the typical item needs to be measured.
BaseTiledLayout
 InheritedtileHorizontalAlign : String
If the item's width is less than the tile bounds, the position of the item can be aligned horizontally.
BaseTiledLayout
 InheritedtileVerticalAlign : String
If an item's height is less than the tile bounds, the position of the item can be aligned vertically.
BaseTiledLayout
 InheritedtypicalItem : DisplayObject
Used internally by a component that supports layout virtualization, such as List, to provide a display object with dimensions that represent a "typical" item in the layout.
BaseTiledLayout
 InheritedtypicalItemHeight : Number
Used to reset the height, in pixels, of the typicalItem for measurement.
BaseTiledLayout
 InheritedtypicalItemWidth : Number
Used to reset the width, in pixels, of the typicalItem for measurement.
BaseTiledLayout
 InheriteduseSquareTiles : Boolean
Determines if the tiles must be square or if their width and height may have different values.
BaseTiledLayout
 InheriteduseVirtualLayout : Boolean
Determines if virtual layout should be used.
BaseTiledLayout
 InheritedverticalAlign : String
If the total column height is less than the bounds, the items in the column can be aligned vertically.
BaseTiledLayout
 InheritedverticalGap : Number
The vertical space, in pixels, between tiles.
BaseTiledLayout
Public Methods
 MethodDefined By
  
Constructor.
TiledColumnsLayout
  
calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
Using the current index and a key press, calculates the new index.
TiledColumnsLayout
  
getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Calculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port.
TiledColumnsLayout
  
getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.
TiledColumnsLayout
  
getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
Used internally by a component, such as List, to determines which indices are visible with the specified view port bounds and scroll position.
TiledColumnsLayout
  
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the optional bounds argument.
TiledColumnsLayout
  
measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
Used internally by a component, such as List, to measure the view port based on the typical item dimensions or cached dimensions, if available.
TiledColumnsLayout
Events
 Event Summary Defined By
 InheritedDispatched when a property of the layout changes, indicating that a redraw is probably needed.BaseTiledLayout
Property Detail
distributeHeightsproperty
distributeHeights:Boolean[override]

If the total height of the tiles in a column (minus padding and gap) does not fill the entire column, the remaining space will be distributed to each tile equally.

If the container using the layout might resize, setting requestedRowCount is recommended because the tiles will resize too, and their dimensions may not be reset.

The default value is false.


Implementation
    public function get distributeHeights():Boolean
    public function set distributeHeights(value:Boolean):void

See also

distributeWidthsproperty 
distributeWidths:Boolean[override]

If the total width of the tiles in a row (minus padding and gap) does not fill the entire row, the remaining space will be distributed to each tile equally.

If the container using the layout might resize, setting requestedColumnCount is recommended because the tiles will resize too, and their dimensions may not be reset.

Note: If the distributeWidths property is set to true, the useSquareTiles property will be automatically changed to false.

The default value is false.


Implementation
    public function get distributeWidths():Boolean
    public function set distributeWidths(value:Boolean):void

See also

pagingproperty 
paging:String[override]

If the total combined width of the columns is larger than the width of the view port, the layout will be split into pages where each page is filled with the maximum number of columns that may be displayed without cutting off any items.

The default value is feathers.layout.Direction.NONE.


Implementation
    public function get paging():String
    public function set paging(value:String):void

See also

requestedColumnCountproperty 
requestedColumnCount:int[override]

Requests that the layout uses a specific number of columns, if possible. If the view port's explicit or maximum width is not large enough to fit the requested number of columns, it will use fewer. Set to 0 to calculate the number of columns automatically based on width and height.

If paging is enabled, this value will be used to calculate the number of columns in a page. If paging isn't enabled, this value will be used to calculate a minimum number of columns, even if there aren't enough items to fill each column.

The default value is 0.


Implementation
    public function get requestedColumnCount():int
    public function set requestedColumnCount(value:int):void
requestedRowCountproperty 
requestedRowCount:int[override]

Requests that the layout uses a specific number of rows in a column, if possible. Set to 0 to calculate the maximum of rows that will fit in the available space.

If the view port's explicit or maximum height is not large enough to fit the requested number of rows, it will use fewer. If the view port doesn't have an explicit height and the maximum height is equal to Number.POSITIVE_INFINITY, the height will be calculated automatically to fit the exact number of requested rows.

If paging is enabled, this value will be used to calculate the number of rows in a page. If paging isn't enabled, this value will be used to calculate a minimum number of rows, even if there aren't enough items to fill each row.

The default value is 0.


Implementation
    public function get requestedRowCount():int
    public function set requestedRowCount(value:int):void
Constructor Detail
TiledColumnsLayout()Constructor
public function TiledColumnsLayout()

Constructor.

Method Detail
calculateNavigationDestination()method
public function calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int

Using the current index and a key press, calculates the new index. This might be use to change a list's selectedIndex when a key is pressed.

Parameters

items:Vector.<DisplayObject>
 
index:int
 
keyCode:uint
 
bounds:LayoutBoundsResult

Returns
int
getNearestScrollPositionForIndex()method 
public function getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point

Calculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port. If the item is already fully displayed in the view port, the current scroll position will be returned unchanged.

While the item will be displayed in the view port without being clipped in any way, it may not be placed in the most prominent position possible. To give the item a more prominent location, use getScrollPositionForIndex() instead.

This function should always be called after the layout() function. The width and height arguments are the final bounds of the view port, which may be calculated in the layout() function.

Parameters

index:int
 
scrollX:Number
 
scrollY:Number
 
items:Vector.<DisplayObject>
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
result:Point (default = null)

Returns
Point
getScrollPositionForIndex()method 
public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point

Using the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.

Typically, this function is used to show the item in the most prominent way, such as centering. To scroll a minimum distance required to display the full bounds of the item in the view port, use getNearestScrollPositionForIndex() instead.

This function should always be called after the layout() function. The width and height arguments are the final bounds of the view port, which may be calculated in the layout() function.

Parameters

index:int
 
items:Vector.<DisplayObject>
 
x:Number
 
y:Number
 
width:Number
 
height:Number
 
result:Point (default = null)

Returns
Point
getVisibleIndicesAtScrollPosition()method 
public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>

Used internally by a component, such as List, to determines which indices are visible with the specified view port bounds and scroll position. Indices that aren't returned are typically not displayed and can be replaced virtually. Uses the typical items dimensions, or cached dimensions, if available.

This function is meant to be called by the List or other component that uses the virtual layout. If you're simply creating a layout for a List or another component, do not call this function. It is meant for developers creating custom components only.

Parameters

scrollX:Number
 
scrollY:Number
 
width:Number
 
height:Number
 
itemCount:int
 
result:Vector.<int> (default = null)

Returns
Vector.<int>
layout()method 
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult

Positions (and possibly resizes) the supplied items within the optional bounds argument. If no bounds are specified, the layout algorithm will assume that the bounds start a 0,0 and have unbounded dimensions. Returns the actual bounds of the content, which may be different than the specified bounds.

Note: The items are not absolutely restricted to appear only within the bounds. The bounds can affect positioning, but the algorithm may very well ignore them completely.

If a layout implementation needs to access accurate width and height values from items that are of type IFeathersControl, it must call validate() manually. For performance reasons, the container that is the parent of the items will not call validate() before passing the items to a layout implementation. Meeting this requirement may be as simple as looping through the items at the beginning of layout() and validating all items that are Feathers UI controls:

const itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
    var item:IFeathersControl = items[i] as IFeathersControl;
    if(item)
    {
        item.validate();
    }
}

Parameters

items:Vector.<DisplayObject>
 
viewPortBounds:ViewPortBounds (default = null)
 
result:LayoutBoundsResult (default = null)

Returns
LayoutBoundsResult
measureViewPort()method 
public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point

Used internally by a component, such as List, to measure the view port based on the typical item dimensions or cached dimensions, if available.

This function is meant to be called by the List or other component that uses the virtual layout. If you're simply creating a layout for a List or another component, do not call this function. It is meant for developers creating custom components only.

Parameters

itemCount:int
 
viewPortBounds:ViewPortBounds (default = null)
 
result:Point (default = null)

Returns
Point