Package | feathers.layout |
Class | public class TiledColumnsLayout |
Inheritance | TiledColumnsLayout BaseTiledLayout starling.events.EventDispatcher |
Implements | IVirtualLayout, IDragDropLayout |
Product Version : | Feathers 1.0.0 |
See also
Property | Defined 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 | ||
gap : Number
Quickly sets both horizontalGap and verticalGap
to the same value. | BaseTiledLayout | ||
horizontalAlign : String
If the total row width is less than the bounds, the items in the row
can be aligned horizontally. | BaseTiledLayout | ||
horizontalGap : Number
The horizontal space, in pixels, between tiles. | BaseTiledLayout | ||
padding : Number
Quickly sets all padding properties to the same value. | BaseTiledLayout | ||
paddingBottom : Number
The space, in pixels, below the items. | BaseTiledLayout | ||
paddingLeft : Number
The space, in pixels, to the left of the items. | BaseTiledLayout | ||
paddingRight : Number
The space, in pixels, to the right of the items. | BaseTiledLayout | ||
paddingTop : 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 | ||
requiresLayoutOnScroll : Boolean [read-only]
Determines if the container calls layout() when the
scroll position changes. | BaseTiledLayout | ||
resetTypicalItemDimensionsOnMeasure : 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 | ||
tileHorizontalAlign : String
If the item's width is less than the tile bounds, the position of the
item can be aligned horizontally. | BaseTiledLayout | ||
tileVerticalAlign : String
If an item's height is less than the tile bounds, the position of the
item can be aligned vertically. | BaseTiledLayout | ||
typicalItem : 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 | ||
typicalItemHeight : Number
Used to reset the height, in pixels, of the typicalItem
for measurement. | BaseTiledLayout | ||
typicalItemWidth : Number
Used to reset the width, in pixels, of the typicalItem
for measurement. | BaseTiledLayout | ||
useSquareTiles : Boolean
Determines if the tiles must be square or if their width and height
may have different values. | BaseTiledLayout | ||
useVirtualLayout : Boolean
Determines if virtual layout should be used. | BaseTiledLayout | ||
verticalAlign : String
If the total column height is less than the bounds, the items in the
column can be aligned vertically. | BaseTiledLayout | ||
verticalGap : Number
The vertical space, in pixels, between tiles. | BaseTiledLayout |
Method | Defined 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 | ||
getDropIndex(x:Number, y:Number, items:Vector.<DisplayObject>, boundsX:Number, boundsY:Number, width:Number, height:Number):int
Returns the index of the item if it were dropped at the specified
location. | 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 | ||
positionDropIndicator(dropIndicator:DisplayObject, index:int, x:Number, y:Number, items:Vector.<DisplayObject>, width:Number, height:Number):void
Positions the drop indicator in the layout. | TiledColumnsLayout |
distributeHeights | property |
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
.
public function get distributeHeights():Boolean
public function set distributeHeights(value:Boolean):void
See also
distributeWidths | property |
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
.
public function get distributeWidths():Boolean
public function set distributeWidths(value:Boolean):void
See also
paging | property |
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
.
public function get paging():String
public function set paging(value:String):void
See also
requestedColumnCount | property |
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
.
public function get requestedColumnCount():int
public function set requestedColumnCount(value:int):void
requestedRowCount | property |
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
.
public function get requestedRowCount():int
public function set requestedRowCount(value:int):void
TiledColumnsLayout | () | Constructor |
public function TiledColumnsLayout()
Constructor.
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 |
int |
getDropIndex | () | method |
public function getDropIndex(x:Number, y:Number, items:Vector.<DisplayObject>, boundsX:Number, boundsY:Number, width:Number, height:Number):int
Returns the index of the item if it were dropped at the specified location.
Parameters
x:Number | |
y:Number | |
items:Vector.<DisplayObject> | |
boundsX:Number | |
boundsY:Number | |
width:Number | |
height:Number |
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 )
|
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 )
|
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 )
|
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 )
|
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 )
|
Point |
positionDropIndicator | () | method |
public function positionDropIndicator(dropIndicator:DisplayObject, index:int, x:Number, y:Number, items:Vector.<DisplayObject>, width:Number, height:Number):void
Positions the drop indicator in the layout. Must be called after
layout()
.
Parameters
dropIndicator:DisplayObject | |
index:int | |
x:Number | |
y:Number | |
items:Vector.<DisplayObject> | |
width:Number | |
height:Number |